jsp写九九乘法表

<%@ 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>My JSP 'jiujiudemo1.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>

<%
int a=Integer.valueOf(request.getParameter("startNumber"));
int b=Integer.valueOf(request.getParameter("endNumber"));
for(int i=a;i<=b;i++){
for(int j=a;j<=i;j++){
out.print(j+"*"+i+"="+(j*i)+"\t");
out.print("&nbsp;&nbsp");
}
out.print("<br/>");
}
%>

</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>My JSP 'jiujiudemo.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>
<p align="center">请输入打印乘法口诀表</p>
<form action="./jiujiudemo1.jsp" method="post">

<table align="center">
<tr>
<td>
startNumber
</td>
<td>
<input type="text" name="startNumber"/>
</td>
</tr>
<tr>
<td>
endNumber
</td>
<td><input type="text" name="endNumber"/>
</td>
</tr>
<tr>
<td>
<input type="submit" value="提交"/>
</td>
<td>
<input type="reset"value="重置"/>
</td>
</tr>

</table>
</form>
</body>
</html>

jsp写九九乘法表jsp写九九乘法表

你可能感兴趣的:(jsp)