aspose file tools*
The moose likes Struts and the fly likes Form Reset Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Form Reset" Watch "Form Reset" New topic
Author

Form Reset

Luv Bhatia
Greenhorn

Joined: Apr 01, 2004
Posts: 16
I am using Struts for my application and have a simple form for user information.AfterI submiting this form,when i come back to the same page, all form elements are filled with previously submiteed value.It seems that the form is not refereshing its value.
Any Advice,
Thanx
Dave Knipp
Ranch Hand

Joined: Oct 14, 2003
Posts: 146
what scope are you putting the form in? session? If you keep the form in the session those values will be persisted as long as the user is logged in. Try putting it in the request. In your action mapping, just put scope="request".
If that doesnt solve it then can you provide more details and we can see what the problem is?
Dave


SCJP 1.4, SCJD 1.4, SCWCD 1.3, SCBCD 1.3, IBM Certified Solution Developer -WebSphere Studio V5.0
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30758
    
156

If you need the form in the session, you can write a reset method in the form that resets all the values to null/empty.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Anand Gondhiya
Ranch Hand

Joined: Feb 24, 2004
Posts: 155
Dave ,
in Action Mapping scope is request. still it doesn't reset the form

Jeanne,
I already have javascript function "resetForm()" which would reset the form values to null (or default)


i.e I have two methods
1.overridden reset() in subclass of ActionForm
2.resetForm() function in javascript

the my goal is still not accomplished !!

waiting for replies
thank you in advance
-Anand.
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30758
    
156

Anand,
Are you using the browser's back button by any chance? If so, the values are cached on the browser and the request is never hitting the server.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Form Reset