JSP第四周作业
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <html> <head> </head> <body> <% request.setCharacterEncoding("utf-8"); String name=request.getParameter("txtUser"); String pwd=request.getParameter("txtPass"); String pwd1=request.getParameter("txtRPass"); String sex=request.getParameter("gen"); String em=request.getParameter("txtEmail"); String y=request.getParameter("year"); %> 用户名:<%=name %> <br> 密码: <%=pwd %> <br> 确认密码:<%=pwd1 %><br> 性别: <%=sex %><br> 电子邮件地址: <%=em %><br> 出生日期: 年: <%=y %> 月: <% String []m=request.getParameterValues("month"); for(String a:m){ out.print(a+" "); } %> 日: <% String []d=request.getParameterValues("day"); for(String b:d){ out.print(b+" "); } %> </body> </html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body> <% String zh=request.getParameter("userid"); String mm=request.getParameter("passwd"); if(zh.equals("lucky")&&mm.equals("123456")){ request.getRequestDispatcher("MyJsp1.jsp").forward(request, response); }else{ request.getRequestDispatcher("MyJsp.jsp").forward(request, response); } %> </body> </html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> </head> <body> <h1>你好:lunck!!!</h1> </body> </html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <STYLE type="text/css"> td{font-size:12px} </STYLE> </head> <BODY> <FORM NAME="myform" METHOD="POST" action="MyJsp2.jsp" > <TABLE align="center"> <TR> <TD> <IMG src="images/Snap1.jpg"><DIV style="position:absolute; left: 720px; top: 216px; width: 356px;"> <TABLE width="100%" height="100%" border=0 cellPadding=0 cellSpacing=0> <TBODY> <TR vAlign=top> <TD width="23%" height=27 align=right class=bld>用户名: </TD> <TD height="27" align=left><INPUT TYPE="text" SIZE="20" NAME="userid"><BR>用户名由字母和数字组成</TD> </TR> <TR vAlign=top> <TD class=bld align=right height=27>密码: </TD> <TD height="27" align=left><INPUT TYPE="password" SIZE="20" NAME="passwd"><BR>密码由字母、数字和下划线组成,至少6位</TD> </TR> <TR vAlign=top> <TD class=bld align=right height=40> </TD> <TD align=left valign="middle"><A href="#"><INPUT name="submit" type="image" src="images/login.gif" width="101" height="22" border="0" ></A> </TD> </TR> </TABLE></DIV> </TD> </TR> </TABLE> </FORM> </BODY> </HTML>