You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mighty Tornado <mi...@gmail.com> on 2009/04/21 04:05:00 UTC

Form doesn't clear

Hi,
Using Struts 1.3, Tomcat 6.

I have the two following problems:

1. I have a screen where I enter some text and call a struts action to
insert it into the database. The action calls a DAO to do that.
When the screen returns, the values I entered in the text fields are still
there and I want them to clear. I want the form to be clean.
2. Even after I restart Tomcat and return to this screen the values are
still there. How can this be? This is a brand new request no? So all the
forms and even the struts servlet should've been instantiated anew no?

Thanks,
.

Re: Form doesn't clear

Posted by Jari Fredriksson <ja...@iki.fi>.
> Hi,
> Using Struts 1.3, Tomcat 6.
> 
> I have the two following problems:
> 
> 1. I have a screen where I enter some text and call a
> struts action to insert it into the database. The action
> calls a DAO to do that. 
> When the screen returns, the values I entered in the text
> fields are still there and I want them to clear. I want
> the form to be clean. 
> 2. Even after I restart Tomcat and return to this screen
> the values are still there. How can this be? This is a
> brand new request no? So all the forms and even the
> struts servlet should've been instantiated anew no? 
> 

If that is a session scoped form, the values will stay, unless you reset them.

You can set them blank in the action before showing the view.. or put value="" in jsp.

    <html:text property="mydata" value="" styleClass="myStyle" />



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


Re: Form doesn't clear

Posted by Mighty Tornado <mi...@gmail.com>.
Thanks, this is all very helpful. I reduced the scope to "request" in the
action mapping. Additionally since it's a DynaActionForm I provided initial
parameters = "", and in the action class called initialize() on the form.
This solved the problem.

On Tue, Apr 21, 2009 at 8:41 AM, Security Management <
list-subscriptions@secmgmt.com> wrote:

> Make sure it's not your browser filling it out and being "helpful".
>
> -----Original Message-----
> From: Mighty Tornado [mailto:mighty.tornado@gmail.com]
> Sent: Monday, April 20, 2009 10:05 PM
> To: Struts Users Mailing List
> Subject: Form doesn't clear
>
> Hi,
> Using Struts 1.3, Tomcat 6.
>
> I have the two following problems:
>
> 1. I have a screen where I enter some text and call a struts action to
> insert it into the database. The action calls a DAO to do that.
> When the screen returns, the values I entered in the text fields are still
> there and I want them to clear. I want the form to be clean.
> 2. Even after I restart Tomcat and return to this screen the values are
> still there. How can this be? This is a brand new request no? So all the
> forms and even the struts servlet should've been instantiated anew no?
>
> Thanks,
> .
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

RE: Form doesn't clear

Posted by Security Management <li...@secmgmt.com>.
Make sure it's not your browser filling it out and being "helpful".

-----Original Message-----
From: Mighty Tornado [mailto:mighty.tornado@gmail.com] 
Sent: Monday, April 20, 2009 10:05 PM
To: Struts Users Mailing List
Subject: Form doesn't clear

Hi,
Using Struts 1.3, Tomcat 6.

I have the two following problems:

1. I have a screen where I enter some text and call a struts action to
insert it into the database. The action calls a DAO to do that.
When the screen returns, the values I entered in the text fields are still
there and I want them to clear. I want the form to be clean.
2. Even after I restart Tomcat and return to this screen the values are
still there. How can this be? This is a brand new request no? So all the
forms and even the struts servlet should've been instantiated anew no?

Thanks,
.


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