1

I am pretty new to JSF and facelets programming, I have followed the instructions in this link How to include another XHTML in XHTML using JSF 2.0 Facelets? to use the <ui:include> tags but strangely i see that the <ui:include> is not working on the page. The tag is showing as is on the rendered xhtml page.(sreenshot attached). My guess it that the ui tag lib is not being picked up. but am not sure where to check.

My config: WAS 8.5 with stock apache myfaces JSF 2.0 implementation. Source of my xhtml page

Community
  • 1
  • 1
Snehan Solomon
  • 432
  • 3
  • 17

1 Answers1

3

You need to make sure that the ui: XML namespace is declared in any parent element as follows:

<anyelement ... xmlns:ui="http://java.sun.com/jsf/facelets">

You also need to make sure that the FacesServlet is in webapp's web.xml being mapped on an URL pattern of *.xhtml, given that you attempted to open it directly on /login.xhtml.

<servlet-mapping>
    <servlet-name>facesServlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
</servlet-mapping>

The FacesServlet is namely the one responsible for among others parsing that XHTML document and producing the HTML output based on it.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • Hi Thanks a lot for answering my question. In my web.xml there is a login filter which redirects to the login page is user session is not present. As a result the FacesServlet was not being initialized. So the include was not working only in the login page. It was your answer that helped me in figuring out whats going. So Thanks again. – Snehan Solomon Feb 09 '14 at 18:51
  • Also your answers on stackoverflow has helped me a lot in learning JSF. :) – Snehan Solomon Feb 09 '14 at 18:52