开发者

Getting post data from request

I'm writing a server side app in Java using the HttpCore library. I have an HttpRequest and I'm trying to get the postdata sent from a form. The problem is- when I use request.getEntit开发者_开发百科y() it returns a null object, even though when I look through HTTPFox on what kind of request I'm sending the post data is clearly there.

What am I doing wrong?


There seems to be some confusion. You are sending requests from a browser to the server. The server is likely using the servlet API. There you handle requests using the doPost(..) method of an HttpServlet. You have an HttpServletRequest from which you can get the parameters - request.getParameter("paramName")

HttpCore on the other hand is used to make requests, not to handle requests. It is used as an http client (in the role of the browser).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜