This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I'm having a strange problem. My application calls 2 different action classes based on the option selected by user. Both the classes got common code at the beginning but they are behaving differently in the common code. When it executes ActionForward method in class ListAction it is getting value in profile object but when it executes ActionForward method in class SearchAction the profile object has null value. It doesn't happen all the times. And when it happens it impacts all users.
If it is seesion related issue I'm wonder why all users get same message ? Really appreciate any suggestions.
[ October 08, 2007: Message edited by: Dilip kumar ] [ October 08, 2007: Message edited by: Dilip kumar ]
Ohhh...I see your problem. There is one thing tricky about action classes that is not obvious: one instance of your action classes is used to process request for multiple users. That means that action classes must be thread safe and cannot contain properties. I see that each of your actions classes have a profile property. I am not exactly sure how you use this so it is hard to recommend an exact solution.
My project had to do some major refactoring a few years ago when a developer joined the team and pointed this out. It looks like you have the profile saved on the session, and that is a good idea since each user will have their own session. If you need to access the profile object in various methods of your action then you will have to pass it around as a parameter.