Richard
Richard

Reputation: 1739

JSF page in subfolder can't see template

I've got a template in WEB-INF/templates/standardTemplate.xhtml

In my "Web Pages" root, I've got an index.xhtml which uses the template via

<ui:composition template="/WEB-INF/templates/standardTemplate.xhtml">

The above works fine.

However I also have another page which uses the same template, but it's in a subfolder "Web Pages"/messageboard/list.xhtml

It uses exactly the same syntax/paths:

<ui:composition template="/WEB-INF/templates/standardTemplate.xhtml">

But it can't find the template and renders just the content of list.xhtml (none of the template's content).

Faces servlet is mapped to "/faces/*"

What am I doing wrong? Tried every variant I can think of but I can't get the right syntax.

Thanks

Upvotes: 1

Views: 1451

Answers (1)

BalusC
BalusC

Reputation: 1108852

As per the comments, you're seeing <ui:composition> unparsed in the HTML output.

That can only mean that the request URL as you've in the browser address bar does not match the URL pattern of the FacesServlet. Make sure that it matches the URL pattern of the FacesServlet. You've mapped it on /faces/*, so the URL should contain the /faces path prefix right after the context path.

Better would be to map the FacesServlet directly on *.xhtml so that you never need to fiddle with virtual URLs.

Upvotes: 2

Related Questions