从servlet调用servlet [英] Calling servlet from servlet
本文介绍了从servlet调用servlet的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从另一个servlet调用一个servlet做两件事:
I would like to call a servlet from another servlet doing two things:
- 将内容类型设置为multipart / form-data
- 将方法设置为POST。
这很容易做到一个表单,但我需要从另一个servlet做。有什么想法?
This is very easy to do from a form, but I need to do it from another servlet. Any ideas how?
推荐答案
你可以用 java.net.HttpUrlConnection
或者可能是Apache HTTP客户端向另一个servlet发送POST / GET请求。您将基本上以与浏览器相同的方式调用其他servlet。
You can use java.net.HttpUrlConnection
or maybe Apache HTTP client to send a POST/GET request to the other servlet. You will basically be invoking the other servlet the same way a browser would.
这篇关于从servlet调用servlet的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文