Announcement Announcement Module
Collapse
No announcement yet.
submitted a form as a POST is comming into the tc server as a get on first hit Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • submitted a form as a POST is comming into the tc server as a get on first hit

    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
    }
Working...
X