How to include a servlet in a JSF page

How to enable servlet page in JSF page. Is there a way to do this?

Thank!

+3


source to share


1 answer


This is possible with a customizable UIComponent

. My colleague Arjan Tijms wrote this article 2 years ago: Facelets and legacy JSP .

This is some code, but the principle is simple, the component executes RequestDispatcher#include()

with a custom HttpServletResponseWrapper

one that captures the recorded output and then writes it to the body of the JSF component.

More recently, this component is also available as <o:resourceInclude>

the OmniFaces libraries maintained by Argen and myself.



Last but not least, I would like to repeat his last words.

I would not recommend using this as a long-term solution, but it could make it easier to migrate from the old JSP with smelly scriptlets and everything to a smarter and more modern Facelets application.

+4


source







All Articles