how to store a user name as a session variable through out the session of that user so that i can use taht user name temporarily in that session????:(
Printable View
how to store a user name as a session variable through out the session of that user so that i can use taht user name temporarily in that session????:(
you write the code so that we can give suggestion.
session.setAttribute()?
I assume your getting the user name from a form. Here's a sample code.
You can call the variable using:Code:<%
//username here is the name of the text field which you will get the username from
String name = request.getParameter("username");
//sessionName is the variable name you assign to the session variable
session.setAttribute("sessionName", name);
%>
Code:<%= session.getAttribute("sessionName") %>
Well, yes...if you're using a JSP to do your work for you...which you shouldn't be doing.
;)