jsp第二次作业

 

 

String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>jsp页面</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>
<%!char a='a';
int i;%>
输出26字母小写:
<%
for(i=1;i<=26;i++){
out.print(a+",");
a+=1;
%>
<%}
%>
<br>
<%!char b='A';
int j;%>
输出26字母大写:
<%
for(j=1;j<=26;j++){
out.print(b+",");
b+=1;
%>
<%}
%>
</body>
</html>

 

 

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>三行五列</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>
<%!int i;
int j;%>
<%
for (i = 1; i <= 3; i++) {
for (j = 1; j <= 5; j++) {
out.println(j + ",");
}
%>
<%
out.print("<br>");
%>
<%
}
%>
</body>
</html>

 

posted @ 2020-04-02 18:38  Zouyhan  阅读(120)  评论(0)    收藏  举报