Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Tomcat Users »

RE: String added to session in servlet not available in jsp

Shapira, Yoav

2003-10-09

Replies:


Howdy,
If you display the session ID before adding the user name, and then in
your JSP as you already do, are they the same session?

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: rudidoku@(protected)]
>Sent: Thursday, October 09, 2003 10:44 AM
>To: tomcat-user@(protected)
>Subject: String added to session in servlet not available in jsp
>
>Hi,
>
>I created a session object and added a string (username) to it.
>Systemout.println shows the username from the request. My page is then
>forwarded to another as follows:
>
>     RequestDispatcher disp = ctx.getRequestDispatcher(target);
>     disp.forward(request, response);
>
>On this jsp page, I have teh following code:
>
> String usr = (String)session.getAttribute("usr");
> out.println("User: " + usr + "!");
> out.println("Session Id: " + session.getId());
>
>The page displays the session Id but not the usr.
>
>I'm quite baffled at why this is the case.
>
>looking in google for similar problems, but any help would be much
>appreciated!
>
>Rudi
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
>For additional commands, e-mail: tomcat-user-help@(protected)




This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@(protected)
For additional commands, e-mail: tomcat-user-help@(protected)


©2008 junlu.com - Jax Systems, LLC, U.S.A.