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?

user7294900
  • 52,490
  • 20
  • 92
  • 189
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();
user7294900
  • 52,490
  • 20
  • 92
  • 189