如何在一个servlet中调用另一个servlet? [英] How to invoke another servlet in a servlet?
本文介绍了如何在一个servlet中调用另一个servlet?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
提到标题时,如何在servlet中调用另一个servlet并获取调用的servlet响应?
As title metioned, How to invoke another servlet in a servlet and get the invoked servlet response?
推荐答案
使用但是,如果您要查看由servlet容器保存的单个实例[例如使用
However, if you're looking at getting hold of the single instance held by the servlet container [like using the getServlet
method in the ServletContext
instance], it's an entirely different story. The servlet specs have purposefully deprecated the operation which might allow such an option. But, if you really want to invoke one servlet while executing the other one, use the include
method of the RequestDispatcher
instead of the forward
method.
这篇关于如何在一个servlet中调用另一个servlet?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文