Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Setting HttpSession Attribute Not Working (Struts)

 
Zak Nixon
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this, maybe it works.
 
Zak Nixon
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just tried that, and it does NOT work.
Thanks

Zak
 
Zak Nixon
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please help.
 
Zak Nixon
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic