'JSP session control'에 해당되는 글 1건

  1. 2008/10/27 How to set and get sessions on JSP code ?
2008/10/27 14:13

How to set and get sessions on JSP code ?

Here's the simple example to set and putsessions.

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>
Trackback 0 Comment 0