This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
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!
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...
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.