I have a simple servlet(HttpServlet) and a simple form submitting data as a POST to the servlet,
On first click the servlet is receiving the request as a get instead of a POST, but on subsiqent clicks its getting the request correctly as a POST.
Please let me know how to get this corrected.

on the javascript side, all I am doing is this
function formSubmit()
{
document.forms['myForm'].action="https://SomeURL.com/something";
document.forms['myForm'].method='POST';
document.forms['myForm'].target='_blank';
document.forms['myForm'].submit();
}

servlet code

public class MyServlet extends HttpServlet {

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//do nothing
}

@Override
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//do something
}