Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

HTTPSession, Struts 2 and Scalability

 
Gobind Singh
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9509
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Checkout this FAQ...
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic