-2

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.

1 Answers1

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
  • post your doGet() method please – Satya Oct 14 '13 at 11:03
  • this is my doGet : public void doGet(HttpServletRequest request, HttpServletResponse response) { doPost(request,response); } – user2878378 Oct 14 '13 at 12:04
  • have you tried like String name=request.getParameter("name"); – Satya Oct 14 '13 at 12:37
  • 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
  • ,any other suggestion? – user2878378 Oct 21 '13 at 08:49