jsp的九九乘法表

来源:互联网 发布:网络银行有哪些 编辑:程序博客网 时间:2024/05/28 16:23

html文件

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>jiujiu.html</title>
 
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
   
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->

  </head>
 
  <body>
    <form action="result.jsp" method="get">
  <p>
   
    开始
    <input type="text" name="start" id="textfield" />
  </p>
  <p>
   
    结束
    <input type="text" name="end" id="textfield2" />
  </p>
  <p>
    <input type="submit" name="submit" id="button" value="提交" />
    <input type="reset" name="reset" id="button2" value="重置" />
  </p>
</form>
  </body>
</html>

jsp文件

<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
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 'result.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.parseInt(request.getParameter("start"));
    int b=Integer.parseInt(request.getParameter("end"));
    for(int i=0;i<=b;i++){
     for(int j=a;j<=i;j++){
      out.println(j+"*"+i+"="+i*j+"&nbsp;&nbsp;");
     
     }
     out.println("<br/>");
   
    }
     %>
     <a href="jiujiu.html">return</a>
  </body>
</html>

 

原创粉丝点击