This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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?