Вопрос

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

Это было полезно?

Решение

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.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top