• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Setting HttpSession Attribute Not Working (Struts)

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try this, maybe it works.
 
Zak Nixon
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please help.
 
Zak Nixon
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
What a show! What atmosphere! What fun! What a tiny ad!
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic