簡單的用戶註冊界面
包括兩個文件:zhuce.htm和zhuce.jsp
zhuce.htm:顯示註冊表單界面
zhuce.jsp:獲取所有的註冊信息並顯示
zhuce.html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<div class="content">
<form action="zhuce.jsp?action=add" method="post">
<table class="res" cellpadding="0" cellspacing="0">
<tr><th class="first" colspan="2">添加個人信息</th> </tr>
<tr><td>用戶名:</td>
<td><input type="text" name="username"/></td>
</tr>
<tr><td>密碼:</td>
<td><input type="text" name="password"/></td>
</tr>
<tr><td>確認密碼:</td>
<td><input type="text" name="rpassword"/></td>
</tr>
<tr><td>生日:</td>
<td><input type="text" name="birthday"/></td>
</tr>
<tr><td>身高:</td>
<td><input type="text" name="tall"/></td>
</tr>
<tr><td>E-mail:</td>
<td><input type="text" name="E-mail"/></td>
</tr>
<tr><td>請選擇你得職業:</td>
<td><input type="radio" name="zhiye" value="工人"/>工人
<input type="radio" name="zhiye" value="農民"/>農民
<input type="radio" name="zhiye" value="軍人"/>軍人
<input type="radio" name="zhiye" value="學生"/>學生</td>
</tr>
<tr><td>請選擇你得籍貫:</td>
<td><select name="area">
<option value="大連">大連</option>
<option value="錦州">錦州</option>
<option value="瀋陽">瀋陽</option>
</select></td>
</tr>
<tr><td>請選擇你得愛好:</td>
<td><input type="checkbox" name="hobby" value="音樂"/>音樂
<input type="checkbox" name="hobby" value="旅遊"/>旅遊
<input type="checkbox" name="hobby" value="讀書"/>讀書</td>
</tr></table>
<tr><td>請輸入你的留言:
<textarea name="liuyan" cols="30" rows="5" wrap="hard"></textarea> </td> </tr>
<table> <tr>
<td colspan="2"><input type="submit" value="提交"/></td>
<td colspan="2"><input type="reset" value="全部重寫"/></td>
</tr></table>
</div>
</body>
</html>
zhuce.jsp<%@ page language="java" contentType="text/html; charset=utf-8"
pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
</head>
<body>
<h2>您註冊的信息如下</h2>
<% request.setCharacterEncoding("utf-8"); %>
<p>
用戶名:<%= request.getParameter("username") %><br />
密碼:<%= request.getParameter("password") %><br />
生日:<%= request.getParameter("birthday") %><br />
身高:<%= request.getParameter("tall") %><br />
E-mail:<%= request.getParameter("E-mail") %><br />
職業:<%= request.getParameter("zhiye") %><br />
籍貫:<%= request.getParameter("area") %><br />
愛好:<%String [] subject = request.getParameterValues("hobby");
for (int i=0;i<subject.length;i++)
{
%>
<%= subject[i] %>
<%} %>
留言:<%= request.getParameter("liuyan") %><br /></p>
</body>
</html>