简体   繁体   中英

How to include servlet in JSF page

How can I include a servlet page , in a JSF page. Is there a way to do that?

Thank!

That's possible with a custom UIComponent . My colleague Arjan Tijms has written a blog article about this 2 years ago: Facelets and legacy 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.

Since recently, this component is also available as <o:resourceInclude> of the OmniFaces library, maintained by Arjan and me.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM