JSP 04课

Posted naoguakerteng

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JSP 04课 相关的知识,希望对你有一定的参考价值。

技术图片

技术图片

<%@ 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 login.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>
  <form action="display.jsp" method="post" name="muform">
  <table border="0" cellpadding="0" cellspacing="0" align="center" width="600px">
 <tr>
    <td height="108" colspan="2"><img src="images/top.jpg"></td>
  </tr>
  <tr>
  <td width="195px" height="35px">用户名:</td>
  <td width="510px"><input type="text" name="tUser"></td>
  </tr>
  <tr>
  <td width="195px" height="35px">密码:</td>
  <td width="510px"><input type="password" name="tPwd"></td>
  </tr>
  <tr>
  <td width="195px" height="35px">确认密码:</td>
  <td width="510px"><input type="password" name="tRwd"></td>
  </tr>
  <tr>
  <td width="195px" height="35px">性别:</td>
  <td width="510px">
  <input type="radio" name="s" value="" checked>男&nbsp;&nbsp;
  <input type="radio" name="s" value="" class="input"></tr>
  <tr>
  <td width="195px" height="35px">email:</td>
  <td width="510px"><input type="text" name="tEm">
  </td>
  </tr>
  <tr>
  <td width="195px" height="35px">出生年月:</td>
  <td width="510px"><input name="year" id="year" size="5" maxlength="5">&nbsp;年&nbsp;&nbsp;
  <select name="month">
  <option value=1>一月</option>
  <option value=2>二月</option>
  <option value=3>三月</option>
  <option value=4>三月</option>
  <option value=5>三月</option>
  <option value=6>三月</option>
  <option value=7>三月</option>
  <option value=8>三月</option>
  <option value=9>三月</option>
  <option value=10>三月</option>
  <option value=11>三月</option>
  <option value=12>三月</option>
  </select>&nbsp;月&nbsp;&nbsp;
  <select name="day">
  <option value=1>1</option>
  <option value=2>2</option>
  <option value=3>3</option>
  <option value=4>4</option>
  <option value=5>5</option>
  <option value=6>6</option>
  <option value=7>7</option>
  <option value=8>8</option>
  <option value=9>9</option>
  <option value=10>10</option>
  <option value=11>11</option>
  <option value=12>12</option>
  <option value=13>13</option>
  <option value=14>14</option>
  <option value=15>15</option>
  <option value=16>16</option>
  <option value=7>17</option>
  <option value=18>18</option>
  <option value=19>19</option>
  <option value=20>20</option>
  <option value=21>21</option>
  <option value=22>22</option>
  <option value=23>23</option>
  <option value=24>24</option>
  <option value=25>24</option>
  <option value=26>26</option>
  <option value=27>27</option>
  <option value=28>28</option>
  <option value=29>29</option>
  <option value=30>30</option>
  <option value=31>31</option>
  </select>&nbsp;日
  </td>
  </tr>
  <TR><TD colspan="2" align="center">
  <br>
  <INPUT type="submit" value="提交">
  </TD></TR>
  </table>
 </form>
  </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 display.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>
  <div align="center">
  <img src="images/top2.jpg">
  </div>
  <div align="center">
  <h1>信息显示</h1>
  <%
  request.setCharacterEncoding("utf-8");
  String name=request.getParameter("tUser");
  String password=request.getParameter("tPwd");
  String sex=request.getParameter("s");
  String email=request.getParameter("tEm");
  String y=request.getParameter("year");
  String m=request.getParameter("month");
  String d=request.getParameter("day");
   %>
   用户名是:<%=name%><br>
   密码是:<%=password %><br>
   性别是:<%=sex %><br>
   电子邮件地址是:<%=email %><br>
   出生日期是:<%=y %>年<%=m %>月<%=d %></div>
  </body>
</html>

 

以上是关于JSP 04课 的主要内容,如果未能解决你的问题,请参考以下文章

JSP 04课

jsp基础语言-jsp代码段

谷歌浏览器调试jsp 引入代码片段,如何调试代码片段中的js

在 JSP 中的 <% %> 代码片段中添加链接

使用IDEA学习JSP代码第006课

使用IDEA学习JSP代码第004课