This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma 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.