<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>注册界面</title>
</head>
<body>
<form>
姓名:<input type = "text" name = "n"/><br>
密码:<input type = "password" name = "p"/><br>
性别:
<input type = "radio" name = "g" value = "男"/>男
<input type = "radio" name = "g" value = "女"/>女<br>
爱好:
<input type = "checkbox" name = "l" value = "音乐"/>音乐
<input type = "checkbox" name = "l" value = "运动"/>运动
<input type = "checkbox" name = "l" value = "电影"/>电影
<input type = "checkbox" name = "l" value = "编程"/>编程<br>
班级:
<select name = "c">
<option value = "2006班">2006班</option>
<option value = "2007班">2007班</option>
</select><br>
个人说明:<br>
<textarea name = "i" rows = "4" cols = "100">请填写个人说明</textarea><br>
<input type = "submit" value = "提交" >
<input type = "reset">
</form>
</body>
</html>
login.jsp 登录界面
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%--在上述的基础上接收最开始的index.jsp界面输入的用户名或者密码 --%>
<% String e_1=(String)request.getAttribute("error_1"); %>
<% String pass=(String)request.getAttribute("p_1"); %>
<% String e_2=(String)request.getAttribute("error_2"); %>
<% String name=(String)request.getAttribute("n_1"); %>
<% String e=(String)request.getAttribute("e"); %>
<%-- 修改用户名信息 --%>
<%if (session.getAttribute("username")!=null) session.removeAttribute("username"); %>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action = "login_OK.jsp">
<%--判断是否为空,如果不为空则表示login_OK接收到最开始的index.jsp的数据又传递回来 --%>
用户名:<input type = "text" name = "n" <% if (name!=null)%>value = "<%=name%>"/>
密码:<input type = "password" name = "p" <% if (pass!=null)%>value = "<%=pass%>"/>
<input type = "submit" value = "提交">
<input type = "reset">
</form>
<%
if(e_1 != null){
out.print("<h3> <font color = red>"+e_1+"</font></h3>");
}
if(e_2 != null){
out.print("<h3> <font color = red>"+e_2+"</font></h3>");
}
if(e != null){
out.print("<h3> <font color = red>"+e+"</font></h3>");
}
%>
</body>
</html>