Making POST requests with parameters in GWT

前端 未结 4 1390
无人及你
无人及你 2021-02-04 05:53

I am trying to do a POST request with a set of parameters to a given URL. The problem I am having is that the POST request is made, but no parameters are passed.



        
4条回答
  •  感情败类
    2021-02-04 06:22

    This should already work - but when using POST, you'll have to read the submitted data differently in your Servlet (I assume, you're using Java on the server side?)

    You could try it with a Servlet like this:

    public class MyServlet extends HttpServlet {
    
        @Override
        protected void doPost(HttpServletRequest req, HttpServletResponse resp)
                       throws ServletException, IOException {
    
            System.out.println(req.getReader().readLine());
        }
    }
    

    Of course, you can copy the contents of req.getReader() or req.getInputStream() to your own buffer or string etc.

提交回复
热议问题