JSP课后作业(一)简单注册界面
// register.html
<%@ page contentType = "text/html;charset = utf-8"%>
<html>
<body>
<form action = "output.jsp" method = "post" name = "form1">
<font size = "4">注册信息</font>
<table width = "700" border = "1">
<tr>
<td><font size = "3">姓名:</font></td>
<td><input type = "text" name = "username" size = "18"></td></tr>
<tr>
<td><font size = "3">年龄:</font></td>
<td><input type = "text" name = "age" size = "18"></td></tr>
<tr>
<td><font size = "3">性别:</font></td>
<td><input type = "radio" name = "radio" value = "男" checked="checked">
<font size = "3">男</font>
<input type = "radio" name = "radio" value = "女">
<font size = "3">女</font>
</td>
</tr>
</table><br>
<input type = "submit" name = "submit" value = "注册" >
</form>
</body>
</html>
// output.jsp
<%@ page contentType = "text/html;charset = utf-8" %>
<html>
<body>
<% request.setCharacterEncoding("iso-8859-1");%>
用户注册信息<br>
<%if(request.getParameter("username").hashCode() == "admin".hashCode()){%>
欢迎您,管理员!
<%} else{%>
用户名:<%= request.getParameter("username") %><br>
年龄:<%= request.getParameter("age") %><br>
性别:<%= request.getParameter("radio") %><br>
注册成功!
<%} %>
</body>
</html>



浙公网安备 33010602011771号