login.jsp
checkLogin.jsp
<%
String name=(String)request.getParameter("name");
String password=(String)request.getParameter("password");
if(name.equals("admin")&&password.equals("admin")){
session.setAttribute("name",name);
session.setAttribute("password",password);
response.sendRedirect("success.jsp");
}else{
response.sendRedirect("error.jsp");
}
%>
success.jsp
<%
String name=(String)session.getAttribute("name");
String password=(String)session.getAttribute("password");
out.println("用户名:");
out.println(name);
out.println("
");
out.println("密码:");
out.println(password);
%>
购买商品