| Here's the simple example to set and put sessions.
save_my_name,jsp <%
String name = request.getParameter( "username" );
session.setAttribute( "theName", name );
%>
<HTML>
<BODY>
<A HREF="next_page.jsp">Continue</A>
</BODY>
</HTML>
save_my_name.jsp saves the user's name in the session, and puts a link to another page, next_page.jsp.
next_page.jsp shows how to retrieve the saved name.
next_page.jsp
<HTML>
<BODY>
Hello, <%= session.getAttribute( "theName" ) %>
</BODY>
</HTML> |