<ui:composition template="/masterTemplate.xhtml" />
or <ui:include src="/toInclude.xhtml" />
A pitfall is to omit the leading slash in
/masterTemplate.xhtml
or /toInclude.xhtml
. The custom resource resolver is only used WITH leading slash. The reason is the implementation of com.sun.facelets.impl.DefaultFaceletFactory#resolveURL(...)
, where this.resolver
is the custom resource resolver:
public URL resolveURL(URL source, String path) throws IOException {
if (path.startsWith("/")) {
URL url = this.resolver.resolveUrl(path);
if (url == null) {
throw new FileNotFoundException(path + " Not Found in ExternalContext as a Resource");
}
return url;
} else {
return new URL(source, path);
}
}