This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Struts and the fly likes Design issue; request/session-objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Design issue; request/session-objects" Watch "Design issue; request/session-objects" New topic
Author

Design issue; request/session-objects

Nems Vedek
Greenhorn

Joined: Sep 26, 2005
Posts: 9
Hello,

I have a .jsp-form that is populated by the actionform. I also have all kind of other information in this page populated by resultbean (content etc).

Resultbean is saved in the action with request.setAttribute("")

If the validation fails, all the stuff in the resultben naturally disappears because they were saved is request-scope.

The question is, what is the right approach to avoid this ? I know that I can go around this problem by saving the resultbeans to session-scope, but is this really the only way ? It just feels rarther stupid to always put everything to the session.

Does the session-objects take away much memory or strain the server badly ?
How about deleting the stuff from session when the forms action has been called (i.e: validation was successful)

Hmm, have been doing web-stuff with plain .jsp / beans before and it just feels that everything is n+1 times complicated with the struts ...

Anyway thanks if someone bothers to answer ...
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30392
    
150

Nems,
Welcome to JavaRanch!

The request remains available until you repaint the JSP page and presumably fill in the form data again. After that, you don't need it anymore, right?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
jQuery in Action, 2nd edition
 
subject: Design issue; request/session-objects