aspose file tools*
The moose likes JSP and the fly likes Problem at Page Reloading Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Problem at Page Reloading" Watch "Problem at Page Reloading" New topic
Author

Problem at Page Reloading

Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

I have a JSP page,named entryforms.jsp. It has some input fields. After user press the submit button the JSP page send the data to servlet file named as RMAEntryServlet.java. My problem is after the datas are inserted into DB, the values in textfields in JSP page seems to be still there. I want them to vanished at page load. Even, writing a JavaScript code to be executed at body onload seems of no use.

Please help me ranchers....


Never try to be a hard-worker. Be a smart-worker.
My Blog
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

1.PRG article

2.PRG pattern

Hope This Helps
Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

I cant get the point.. Will you please explain me clearly... Please help this noob...
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

HI,

1. submit the form(jsp) using POST method to servlet

2. in servlet: get the form data and do some business logic(iserting ,etc to the DB)

3. then REDIRECT to the success.jsp[do not use REQUESTDISPATCHER]

please do this. after that if you refresh it wont affect DB
Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

Originally posted by seetharaman venkatasamy:
HI,

1. submit the form(jsp) using POST method to servlet

2. in servlet: get the form data and do some business logic(iserting ,etc to the DB)

3. then REDIRECT to the success.jsp[do not use REQUESTDISPATCHER]

please do this. after that if you refresh it wont affect DB

1.i do that
2.Yes i do
3.OK
4.If i use response.sendRedirect method it shows an error saying that the file name is not valid....
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

can you post the error message?
Dawn Charangat
Ranch Hand

Joined: Apr 26, 2007
Posts: 249
Hi..,

I take it that, the javascript snippet you wrote was to clean the text fields at page load...correct ? Can you try a different approach ?

Instead of trying to manually clean each and every field, try form.reset().
Just check it out.... hope that helps.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61206
    
  66

"Dawn CS", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem at Page Reloading