aspose file tools*
The moose likes Struts and the fly likes Session Issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Session Issue" Watch "Session Issue" New topic
Author

Session Issue

Dilip kumar
Ranch Hand

Joined: Oct 16, 2000
Posts: 360
Hello All,

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 ]
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
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.

- Brent
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session Issue