3

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

Thank!

1
  • Check this Commented Apr 1, 2012 at 22:41

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.