1

Example: window.open("LoginServlet", "_self");

This code will make the browser to redirect to LoginSevlet but it executes doGet method of Servlet but I want to execute the doPost method.

Is there any way through which I can directly execute the doPost method of LoginServlet?

Ori Marko
  • 56,308
  • 23
  • 131
  • 233
ATUL PATIL
  • 21
  • 3

1 Answers1

0

Click a form with target="_self" and method="post":

 <form name="postForm" method="post" action="LoginServlet" target="_self">
 </form>

And submit it instead of window.open:

 document.forms["postForm"].submit();
Ori Marko
  • 56,308
  • 23
  • 131
  • 233