jsp用户注册页面
1、注册页面
<h1>请输入用户注册信息:</h1>
<form method="post" action="chack.jsp">
用户名:<input type="text" name="username" value=""/>*<br/>
真实姓名:<input type="text" name="truename" value=""/>*<br/>
密码:<input type="password" name="password" value=""/>*<br/>
确认密码:<input type="password" name="password2" value=""/>*<br/>
电子邮箱:<input type="text" name="email" value=""/><br/>
<input type="submit" value="提交" />
<input type="reset" value="重置"/>
</form>
2、判断是否正确及错误返回
<jsp:useBean id="pbean" class="bean.userbean" scope="session">
</jsp:useBean>
<% userbean ub=new userbean();
ub.setUsername(request.getParameter("username"));
ub.setTruename(request.getParameter("truename"));
ub.setPassword(request.getParameter("password"));
ub.setPassword2(request.getParameter("password2"));
if(ub.check()!=("")){
out.println("清重新输入信息 5秒钟后返回注册页面"+ub.check());
response.setHeader("refresh","5;url=exercise1.jsp");
}
else{request.setAttribute("uesrname",ub.getUsername());
response.sendRedirect("sub.jsp");
}
%>
3、成功界面
恭喜你, 注册成功! <br>