File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Design issue; request/session-objects" Watch "Design issue; request/session-objects" New topic

Design issue; request/session-objects

Nems Vedek

Joined: Sep 26, 2005
Posts: 9

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
author & internet detective

Joined: May 26, 2003
Posts: 33107

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?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: Design issue; request/session-objects
It's not a secret anymore!