| Author |
Setting HttpSession Attribute Not Working (Struts)
|
Zak Nixon
Ranch Hand
Joined: Sep 27, 2003
Posts: 126
|
|
Hello all: I am trying to create a simple login action for my website. I have a login.jsp page that finds the users credentials, and if valid, saves the users object in the HttpSession. Here is my code for the login action: And the corresponding ActionMapping in my struts-config.xml: And the corresponding form-bean declaration: This is the many attempts to try to retrieve the "user" object: I always seem to get that the attribute,"user", is never set, therefore not being able to be retrieved. Can anyone help me? Thanks Zak
|
 |
Leandro Melo
Ranch Hand
Joined: Mar 27, 2004
Posts: 401
|
|
Try this, maybe it works.
|
Leandro Melo <br />SCJP 1.4, SCWCD 1.4<br /><a href="http://www.pazbrasil.org/" target="_blank" rel="nofollow">http://www.pazbrasil.org/</a>
|
 |
Zak Nixon
Ranch Hand
Joined: Sep 27, 2003
Posts: 126
|
|
I just tried that, and it does NOT work. Thanks Zak
|
 |
Zak Nixon
Ranch Hand
Joined: Sep 27, 2003
Posts: 126
|
|
I have made sure that my object was being saved. I successfully retrieved it inside another Action that my application executed. Is there anything wrong with my .jsp page? Thanks Zak
|
 |
Zak Nixon
Ranch Hand
Joined: Sep 27, 2003
Posts: 126
|
|
|
Please help.
|
 |
Zak Nixon
Ranch Hand
Joined: Sep 27, 2003
Posts: 126
|
|
CODE] <logic: present name="user" scope="session">This attribute is here.</logic: present>[ [/CODE] It does work. I did not see the change from 'parameter' to 'name'. A million thanks. Zak
|
 |
Leandro Melo
Ranch Hand
Joined: Mar 27, 2004
Posts: 401
|
|
How does the code (the one inside logic tag) look like after processing (from the browser)? Have you make sure you included the struts logic tag library? Also, what kind of object is user? Are you trying to retrieve the property correctly? [ July 26, 2004: Message edited by: Leandro Melo ]
|
 |
 |
|
|
subject: Setting HttpSession Attribute Not Working (Struts)
|
|
|