Today, I saw a JSP page value transfer in my book. I think it is easier than on the web page. I want to take notes for myself and learn from other users.
Session. jsp page
<HTML>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> session </title>
</Head>
<Body>
<H1> session <Form action = "session1.jsp" method = "Post">
<Input type = "text" name = "username"/>
<Input type = "Submit" value = "Enter your username"/>
</Form>
</Body>
</Html>
Session2.jsp code
<HTML>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> session1 </title>
</Head>
<Body>
<%
String name = request. getparameter ("username ");
Session. setattribute ("name", name );
%>
Username is <% = Name %>
</Body>
</Html>
Session2.jsp code
<HTML>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> session2 </title>
</Head>
<Body>
Username: <% = session. setattribute ("name"); %>
</Body>
</Html>