Reputation: 4700
How can I include a servlet page , in a JSF page. Is there a way to do that?
Thank!
Upvotes: 3
Views: 945
Reputation: 1109655
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.
Upvotes: 4