JSP第一周作业

1.1.环境搭建,运行出来一个JSP页面,显式hello

 

2.英文字母表

 1 <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
 2 <%
 3 String path = request.getContextPath();
 4 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
 5 %>
 6 
 7 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 8 <html>
 9   <head>
10     <base href="<%=basePath%>">
11     
12     <title>My JSP 'MyJsp01.jsp' starting page</title>
13     
14     <meta http-equiv="pragma" content="no-cache">
15     <meta http-equiv="cache-control" content="no-cache">
16     <meta http-equiv="expires" content="0">    
17     <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
18     <meta http-equiv="description" content="This is my page">
19     <!--
20     <link rel="stylesheet" type="text/css" href="styles.css">
21     -->
22 
23   </head>
24   
25   <body>
26     <p style="font-family: 黑体;font-size: 36">
27   <br>英文字母表:</br>
28   </p>
29   <p style="font-family: 宋体;font-size: 25;color: blue">
30   <% char upperCase;
31      char lowerCase;
32      for(upperCase = 'A';upperCase < 'Z';upperCase++){
33      lowerCase=(char)(upperCase+32);
34      out.print(upperCase+"("+lowerCase+")"+" ");
35      if(upperCase =='M')
36      out.print("<br>");
37      }
38    %>
39    </p>
40   </body>
41 </html>

 

3.99乘法表

 1 <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
 2 <%
 3 String path = request.getContextPath();
 4 String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
 5 %>
 6 
 7 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 8 <html>
 9   <head>
10     <base href="<%=basePath%>">
11     
12     <title>My JSP 'MyJsp02.jsp' starting page</title>
13     
14     <meta http-equiv="pragma" content="no-cache">
15     <meta http-equiv="cache-control" content="no-cache">
16     <meta http-equiv="expires" content="0">    
17     <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
18     <meta http-equiv="description" content="This is my page">
19     <!--
20     <link rel="stylesheet" type="text/css" href="styles.css">
21     -->
22 
23   </head>
24   
25   <body>
26    <p style="font-family: 宋体;font-size: 15;color: green">
27    <% 
28    for(int j = 1;j<=9;j++){
29     for(int i=1;i<=j;i++){
30     int n =i*j;
31     out.print(i+"X"+j+"="+n+" ");
32     }
33     out.print("<br>");
34     }
35     %>
36     </p>
37   </body>
38 </html>

 

posted @ 2022-03-02 17:49  宇文92  阅读(15)  评论(0编辑  收藏  举报