In struts 1.2 action classes are singleton ,so each action class is multi threaded for serving many request.So I have to declare declare all parameter inside of execute method or can I declare outside of execute method.If it is declared outside ,when multi threaded it does not make any problem?
Struts 1 action classes are multithreaded, which means you must code them as thread-safe. In a thread-safe object, the only instance variables are those that do not change from one user to the next. All other variables should be local variables within methods.
For example, if you have a Logger class that writes to a log, it would be fine to make this an instance variable since the same instance of this class could safely be used by multiple users. However, if you have a variable called balance representing an individual user's account balance, it would be disastrous to make this an instance variable because one user could place a value in the variable and in the next thread another user could pick up the same value.