第六次作业
1.
<%@ 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 '1.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"> <form action="2.jsp" method="get"> <table style="float: left"> <tr> <td>用户名:<br><br></td> <td><input type="text" name="user" /><br><br> </td> </tr> <tr> <td>密码:<br><br></td> <td><input type="password" name="password" /><br><br> </td> </tr> <tr> <td>确认密码<br><br></td> <td><input type="password" name="password2" /><br><br> </td> </tr> <tr> <td>性别<br><br></td> <td><input type="radio" name="sex" value ="男"/> 男 <input type="radio" name="sex" value ="女"/> 女<br> </td> </tr> <tr> <td>电子邮件<br><br></td> <td><input type="email" name="email"><br><br> </td> </tr> <tr> <td>出生日期<br><br></td> <td><input type="date" name="date"><br><br> </td> </tr> <tr> <td colspan="2" align="right"><input type="submit" value="同意以下协议条款并提交"> </td> </tr> </table> </form> <br> <br> <br> <br> <br> <br> <br><br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <br> <textarea cols="50" rows="10" style="float: left;"> 无 </textarea> </div> </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 '2.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> <h1>您注册的信息如下</h1> <% request.setCharacterEncoding("utf-8"); String str=request.getParameter("user"); String user=new String(str.getBytes("ISO-8859-1"),"utf-8"); String password=request.getParameter("password"); String a=request.getParameter("sex"); String sex=new String(a.getBytes("ISO-8859-1"),"utf-8"); String email=request.getParameter("email"); String date=request.getParameter("date"); %> 用户名:<%=user %><br> 密码:<%=password %><br> 性别:<%=sex %><br> 电子邮件:<%=email %><br> 出生日期:<%=date %> <br> </body> </html>