I have observed that when the address in the address bar is selected and an enter key is pressed,the doGet method is invoked and not the doPost method. How to invoke the doPost method ,and not doGet.
Asked
Active
Viewed 779 times
-2
-
follow the link http://stackoverflow.com/questions/2482059/disable-f5-and-browser-refresh-using-javascript – Pankaj Sharma Oct 14 '13 at 10:10
-
i want to prevent the refresh,when I click on the address bar and then press enter?(not only the F5 ,ctrl+R)? – user2878378 Oct 14 '13 at 12:38
1 Answers
0
add this in your doGet() method
doPost(request,response);
and it will work

Satya
- 8,693
- 5
- 34
- 55
-
I see that the doPost gets invoked from doGet method,but when I access the parameters from doPost using 'request.getparameter(),i am getting null values. – user2878378 Oct 14 '13 at 10:39
-
-
this is my doGet : public void doGet(HttpServletRequest request, HttpServletResponse response) { doPost(request,response); } – user2878378 Oct 14 '13 at 12:04
-
-
In doPost I have these type of commands.And they work fine if I am directly submitting the form by clicking the submit button.But the problem comes after I submit the form,if I click on the address bar and press enter.As I mentioned earlier if I invoke doPost from doGet,the String name=request.getParameter("name"); is returning null. – user2878378 Oct 14 '13 at 12:47
-
remove method parameter from your form tag and then try clicking on the URL , – Satya Oct 14 '13 at 14:42
-
so you are suggesting to write the code in doPost to doGet?but i am passing lot of values (URL length will become 3500+) ,in that case doGet is not working. – user2878378 Oct 14 '13 at 14:46
-