This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
First of all thanks for the reply ..So does that mean than any instance variable in the action class is shared my multiple user . If yes how can I avoid this situation .. My code has a requirement to keep instance varialbe which should be specific to a user ..How should I deal with itt..
If the instance variable is local to the action form, you may store it as a property in the actionForm bean. when the action form is mapped as session scope (default), it is stored as a session attribute and implicity loaded by struts when the action is used. Note that while the action handler needs to be thread safe, the actionForm bean is a bean.
another alternative if the data you want to store for a user is not specific to a screen or an action, you can store it into a normal session attribute.
Error: Keyboard not attached. Press F1 to continue.
Joined: Feb 15, 2005
Anyone who is making instance variables in Action classes a "requirement" is asking for an application that doesn't work -- or even worse -- sometimes works and sometimes doesn't. If you need data for a single user to psersist between requests, put that data in the user's HTTPSession. For example: