struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: ActionForm clearing
Date Sat, 07 Oct 2000 00:48:05 GMT
Yun Sang Jung wrote:

>
>
> [Image]
> >
> > Here's how I normally handle this scenario.  In the Action class that
> > handles this form submit:
> > * Perform whatever task is requested
> > * Remove the form bean session attribute
> > * Forward to whatever JSP page is appropriate.
> >
> > When the  tag of the form sees that there is no form bean
> > there, it will create a new one (with whatever default values you have
> > defined in the class itself) and store it in the session.  From the user's
> > perspective, that's a new blank form.
> >
> > In general, it is a good practice to delete form beans from the session when
> > you are through with them -- otherwise they just sit there occupying memory
> > until the session is invalidated or timed out.
>
> Did you mean I should call
> "session.removeAttribute(mapping.getFormAttribute()); "?
>

Yes, that is exactly the kind of thing you can do when you no longer
need the form bean.  If this was the only reference to that bean (which
is the normal case), it will now be available for garbage collection.

Craig

====================
See you at ApacheCon Europe <http://www.apachecon.com>!
Session VS01 (23-Oct 13h00-17h00):  Sun Technical Briefing
Session T06  (24-Oct 14h00-15h00):  Migrating Apache JServ
                                    Applications to Tomcat


Mime
View raw message