• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How I can access session objects within Form object extended ActionForm class

 
Tob
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How I can access data or objects stored into session object (stored from an earlier screen)within Form object extended ActionForm class.
For example when the user login I am storing user id and preferences in session. Later on I need the same parameters from session to do processing that is based on user ID.
I know how to do that in object that extends Action class but not sure how to do it in Form. Any help is highly appreciated!
 
Perry McKenzie
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Toplica,
If I understand you question correctly, here's what I would do...
I would make the userID and preferences (your examples) attributes in your ActionForm super class. That way, every ActionForm class is extended has those values. I haven't entirely thought this through or tested it, but it seems in theory like it should work. You may have to reset these values every time you change ActionForms, but as long as they are children of the same super class...
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
insert hidden tags into your form and fill it while runtime with the two values you like. Then add this fields also to your form, and you always will have the correct values in your form class.
The prob is that you cannot access the Request or Session in the FormClass.
I think thats only possible in the validate method.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic