define search -> search/store results in session -> intersitial -> JSP showing results from search -> selecting a result -> viewing details of search
I have a threaded class that puts a set of results in the session under a key. I am not sure if it is better to just put the result set into the session from the original action class (and passing it to the search class), or trying to add it to a form that I will use later. It seems that whichever way I do it isn't really elegant. I have the form as session scope, but because the results form isn't created until after the search is done, that doesn't really help me.
Why not just add the result set as a property in your session-scoped ActionForm bean? Then, just allow it to be null until the search process is complete. Your JSP can use <logic:notEmpty> to determine whether to display it or not.
Can you do that if you have different Forms? I have a form that has the original request data, then I move to the search form and then to the display results form. Are you saying to just keep the one request form, with a attribute for results that is null until the search is complete?
posted 14 years ago
If you have different ActionForms for each action, then no, this technique will not work.
Are you saying to just keep the one request form, with a attribute for results that is null until the search is complete?
Yes, That's exactly what I'm saying. That's how I normally handle searches. I typically even use the same JSP for both entering search criteria and displaying results. I just put <logic:notEmpty></logic:notEmpty> tags around the result table so that it's only visible if there are results to display.