----- Original Message -----
From: Joel Shellman <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 28, 2001 4:22 PM
Subject: Removing ActionForm's from context


> I don't quite understand the the below quote from the example tour. The
> paragraph doesn't make sense. Anything in request scope will be removed
> after the request is over automatically. So there's no need to remove it
> just so if the user comes back later to the same page--it would have
> been long gone before then. Right? What is it talking about?
>

Right, using request scope should avoid population of a form from old values. But 
request scope is not always used.
Moreover if you forward the request to another Action or a jsp, you might not want 
them to have access to the form,
which can eventually contain sensible data like a password.

This is my feeling about it,

Jean-Noel


> Thanks!
>
> Before returning from a successful login, LogonAction also disposes of
> the LogonForm bean. This way, if the
> user returns to the index.jsp form later, it will be a clean form
> without the (old) login already entered. Note
> that LogonAction first checks to see if the scope has been set to
> "request", and then removes the bean from
> the request context, or otherwise from the default session context.
>
>               The Struts best practice is to use request scope for
> single-page forms that contain all of your
>               relevant properties, because there is no need to maintain
> such form beans across requests.
>
>               Note that the example removes the LogonForm bean
> regardless of scope. This is for backward
>               compatibility with earlier configurations. In your
> application, you should follow the advice of
>               the configuration, and remove it only if the scope is set
> to "request". This way, the behavior
>               can be changed just by editing struts-config.xml and
> reloading the application. "
>
> --
> Joel Shellman
> KnOcean Interactive Corporation
> http://www.knocean.com/
>

Reply via email to