[英]How to include servlet in JSF page
How can I include a servlet page , in a JSF page. 如何在JSF页面中包含servlet页面。 Is there a way to do that? 有没有办法做到这一点?
Thank! 谢谢!
That's possible with a custom UIComponent
. 使用自定义UIComponent
可以实现这一点。 My colleague Arjan Tijms has written a blog article about this 2 years ago: Facelets and legacy JSP . 我的同事Arjan Tijms在2年前撰写了一篇博客文章: Facelets和遗留JSP 。
It's some code, but the principle is easy, the component does a RequestDispatcher#include()
with a custom HttpServletResponseWrapper
which captures the written output and then writes it to the body of the JSF component. 这是一些代码,但原理很简单,组件使用自定义HttpServletResponseWrapper
执行RequestDispatcher#include()
,它捕获写入的输出,然后将其写入JSF组件的主体。
Since recently, this component is also available as <o:resourceInclude>
of the OmniFaces library, maintained by Arjan and me. 从最近开始,这个组件也可以作为OmniFaces库的<o:resourceInclude>
,由Arjan和我维护。
Last but not least, I'd like to repeat his last words. 最后但并非最不重要的是,我想重复他的最后一句话。
I wouldn't recommend using this as a lasting solution, but it might ease a migration from legacy JSP with smelly scriptlets and all on them to a more sane and modern Facelets application. 我不建议使用它作为一个持久的解决方案,但它可以简化从带有臭臭小脚本的遗留JSP的迁移,以及所有这些对更健全和更现代的Facelets应用程序的迁移。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.