jsp第二次

    <%
    Calendar c=Calendar.getInstance();
    int h=c.get(Calendar.HOUR);
    int m=c.get(Calendar.MINUTE);
    int s=c.get(Calendar.SECOND);
    String a="";//java注释
    if(h>=0&&h<=12){
        a="上午好";
    }
    if(h>=13&&h<=17){
        a="下午好";
    }
    if(h>=18&&h<=23){
        a="晚上好";
    }
     %>
     <tr align="center"><td>现在时间是:<%=h %>:<%=m %>:<%=s %>--<%=a %></td></tr>

 

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
     
    <title>My JSP 'index.jsp' starting page</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">   
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
  </head>
   
  <body>
    <%!
        public String year(int theYear) {
            return "不是";
        }
    %>
    <!-- 显示是否为闰年 -->
    <h2>
    2023 <%= year(2023) %> 闰年
    </h2>
  </body>
</html>

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  </head>
  <body>
    <%
    for(int x=1;x<=5;x++){    
     %>                              <%--循环5次输出直线 --%>
     <hr width="<%=x*100%>px">
     <br>
     <%} %>
     
  </body>
</html

 

 

posted @ 2022-03-14 20:01  温凯文  阅读(35)  评论(0)    收藏  举报