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

HTTPSession, Struts 2 and Scalability

Gobind Singh
Ranch Hand

Joined: Aug 04, 2006
Posts: 62
I have a struts 2 application which has many JSPs that display a list of results on the screen.
The process is as follows:

DisplayCriteriaForm: - This action class simply goes to a JSP that displays some fields on the screen for the user to enter
DisplayResultsAction - This action takes the request parameters from the JSP mentioned above and displays the results by querying the database and returning a collection
ValidationSelectionAction - The idea is the user can select one of the results returned and this action simply validates if one of the checkboxes was selected. If nothing was selected I want to remain on the same page (i.e. the results jsp) with a actionError at the bottom saying "please select a item".

The problem I have is that ValidationSelectionAction needs to have access to the list of results the DisplayResultsAction had retrieved from the Database so it can redisplay the same page upon encountering an actionError. The only way I can do it at the moment is to store the results in the HTTPSession object so that ValidationSelectionAction can retrieve them and return them in a getter method.

While this solution does work, it is not scalable due to the heap being utilized with HTTPSession. In a multi-user environment it is known to crash the system when the sessions gets too full. There are many J2EE best practices that I have seen that also say not to overuse the session. But no-one has mentioned alternatives.
Is there anyway to pass complex data between actions without using the session? Are there any other frameworks that handle this responsibiity for you out there?
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9321
    
  17

Checkout this FAQ...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HTTPSession, Struts 2 and Scalability