denglu.jsp
<form action="check.jsp" method="post">
<input type="text" name="uname" /> </br>
<input type="password" name="upwd"/> </br>
<input type="submit" value="登录"/> </br>
</form>
check.jsp
<%
request.setCharacterEncoding("utf-8");
String name=request.getParameter("uname");
String pwd=request.getParameter("upwd");
if(name.equals("qwe")&&pwd.equals("123")){
request.getRequestDispatcher("success.jsp").forward( request,response);// 页面跳转重定向,跳到success.jsp读取数据仍然从这个页面读取。
}else{
out.print("登录失败");
}
%>
seccess.jsp
欢迎您:
<%
out.print(request.getParameter("uname"));
%>