Passing parameters from servlet to servlet using HTTP POST

How do I pass parameters from ServletOne to ServletTwo using a HTTP POST through URL intead of using HTTP GET in the servlet?

For example: http://localhost/ServletOne?username=test

If the above link is accessed, in ServletTwo, username test will be displayed.


You've a problem in your class design. The ServletTwo has apparently some code which needs to be reused in ServletOne . You need to refactor that code into a separate Java class. Once done that, all you need to do is to just import/use that Java class in both servlet classes the usual Java way.

链接地址: http://www.djcxy.com/p/41106.html

上一篇: 如何在jmeter http请求中同时发布帖子和获取参数

下一篇: 使用HTTP POST将参数从servlet传递到servlet