struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Erickson" <derick...@cmcflex.com>
Subject Re: Removing form bean from where ever it is saved
Date Tue, 01 Jun 2004 16:12:36 GMT
The key its stored under is simply the name you define it as in the
form-bean section in your struts config. IE:
<form-bean name="myBean" type="com.something.Form"/>

and then an action using this

<action .... name="myBean" scope="session">

Would put an instance of com.something.Form into the session scoped
attribute named myBean.
If you want to remove that bean from session at the end of your action you
could do something like:

if ("session".equalsIgnoreCase(mapping.getScope())) {
    request.getSession().removeAttribute(mapping.getName());
}

HTH,
David

----- Original Message ----- 
From: "Tim Penhey" <tim@penhey.net>
To: "Struts Users Mailing List" <user@struts.apache.org>
Sent: Tuesday, June 01, 2004 10:03 AM
Subject: Removing form bean from where ever it is saved


> Hi All,
>
> I am trying to test some validation that I have set up for one of my
actions.
> I am using the org.apache.struts.validator.DynaValidatorForm with a couple
of Strings and
> an Integer.  However in my test to check the required validation, it
appears to be
> grabbing an existing form from some scope (almost certainly session) and
only updating the
> parameters that I have passed in.
>
> How can I remove the form from scope after the action has finished with
it?  I don't know
> that key that it is being stored against, is this defined somewhere?
>
> Thanks,
> Tim
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message