aspose file tools*
The moose likes JSP and the fly likes how to get reset to work after form submit in JSP? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "how to get reset to work after form submit in JSP?" Watch "how to get reset to work after form submit in JSP?" New topic
Author

how to get reset to work after form submit in JSP?

Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

I'm trying to write a web app where I submit a form in my jsp to a servlet . My form fields are reference through a bean ie . of the forn

Now I persist the value of the entered fields in the bean through request, However when i try to reset the page using a reset button, it doesnt work...
I know that the page is reloaded with the values that correspond to "bean.textfield" but is there a workaround to clear the form after submission??


Learning and Learning!-- Java all the way!
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

Solved it using a manual clear() function in JS , open to better solutions though..
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61206
    
  66

You cannot do anything to the form after submission. Submitting the page makes it simply go away.

If you are then displaying the same page, it's another page completely and you need to deal with it as such.

So the question comes down to: if you don't want the fields to have initial values, why are you putting them there in the first place?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Vic Hood
Ranch Hand

Joined: Jan 05, 2011
Posts: 477

Thanks for replying Bear!
Well the initial values were preloaded in the request . So I had to explicitly clear the values of each of the text fields.
Dont know whether this was the right approach.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to get reset to work after form submit in JSP?