<%@ 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><formname= "Denglu"Action= "session.jsp"Method= "POST">Login:<inputtype= "text"name= "Name"><BR>Hobbies:<textareaname= "Aihao" ></textarea><BR><inputtype= "Submit"value= "Submit"></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><%stringname=request.getparameter ("name");Session.setattribute ("name", name); String Aihao=request.getparameter ("Aihao");Session.setattribute ("Aihao", Aihao);>Submit Success</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><%stringname=newString (Session.getattribute ("name"). ToString (). GetBytes ("Iso-8859-1"), "UTF-8"); String Aihao=newString (Session.getattribute ("Aihao"). ToString (). GetBytes ("Iso-8859-1"), "UTF-8"), Out.print ("User: +name+" < BR>out.print ("Hobby:" +aihao+ ")<BR>");%></Body></HTML>
Create login interface, log in successfully after the user name in the session, on the 3rd page to read the session display user name