<%@ Pagelanguage= "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><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8"><title>Insert Title here</title></Head><Body><%session.invalidate();%><formAction= "yanzheng.jsp"Method= "POST">User name:<inputtype= "text"name= "Yonghu">Password:<inputtype= "Password"name= "Mima"><inputtype= "Submit"value= "Login"></form></Body></HTML>
<%@ Pagelanguage= "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><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8"><title>Insert Title here</title></Head><Body><%try{String Yonghu=newString (Request.getparameter ("Yonghu"). GetBytes ("Iso-8859-1"), "UTF-8"); String Mima=request.getparameter ("Mima"); if (yonghu.equals ("small") && mima.equals ("123")) {Session.setattribute ("Yonghu", Yonghu); Response.sendredirect ("zhuye.jsp"); } else {out.print ("User name or password is wrong, please re-enter"); Response.setheader ("Refresh", "3; URL=denglu.jsp "); }}catch (Exception e) {out.print ("Please login from the login screen"); Response.setheader ("Refresh", "3; URL=denglu.jsp ");}%></Body></HTML>
<%@ Pagelanguage= "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><Metahttp-equiv= "Content-type"content= "text/html; charset=gb2312-80"><title>Insert Title here</title></Head><Body><%objectobj=session.getattribute ("Yonghu");if (obj==null){out.print ("Please login First"); Response.setheader ("Refresh", "3; URL=denglu.jsp ");}else{String a=newString (obj.tostring ()); Out.print ("Welcome " +a+ " login");
%>
<br><a href= "denglu.jsp" ><input type= "button" value= "Sign Out" ></a>
<%
%>
</ Body > </ HTML >
Session Save User Login