JSP习题之九九乘法表,输出时间和问候

来源:互联网 发布:mac怎么连接airplay 编辑:程序博客网 时间:2024/05/05 05:37

3.
九九乘法表


table width=”600” height=”300” align=”center” border=”2”
<%
for(int i=1;i<=9;i++){
%>
tr
<%
for(int j=1;j<=i;j++){%>
td
<%out.print(i+”*”+j+”=”+i*j) ;%>
<% }%>/tr
<% }%>
/table
/body
/html

4.
输出时间和问候

body
%@ page contentType=”text/html; charset=utf-8” %
img src= **.jpg width=50


<% java.util.Date today=new java.util.Date();%>
当前时间: 北京时间:
<%=today.getYear()+1900%>年
<%=today.getMonth()+1 %>月
<%=today.getDate() %>日
<%=today.getHours() %>时
<%=today.getMinutes() %>分



<%
int number=today.getHours();
String msg=”你好”;
switch(number){
case 8:
case 9:
case 10:
case 11:{
msg=”欢迎您访问我的个人网站”;
break;
}
case 12:{
msg=”此图有美女”;
break;
}
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:{
msg=”此图有萌宠”;
break;
}
case 19:
case 20:
case 21:
case 22:{
msg=”此图有田野”;
break;
}
case 23:
case 24:{
msg=”非常感谢您还在访问我的个人网站,注意保存哦!”;
break;
}
}
out.println(“

“+msg+”

“);
%>


table width=”100%” cellpadding=”4” cellspacing=”0” align=”center” bordercolor=”#A6CAF0” border=”1”
tr
td
div align=”center”

一人一世界

你的世界不是只有萌宠,可萌宠的世界却只有一个你。

所以,在它有限的时间里请好好的陪伴它.

/div
/td
/tr
/table
/body
/html
0 0
原创粉丝点击