Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem at Page Reloading

 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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....
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1.PRG article

2.PRG pattern

Hope This Helps
 
Rajkumar balakrishnan
Ranch Hand
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I cant get the point.. Will you please explain me clearly... Please help this noob...
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 445
Android Eclipse IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you post the error message?
 
Dawn Charangat
Ranch Hand
Posts: 249
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64833
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Dawn CS", please check your private messages for an important administrative matter.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic