Pergunta

I watched the facelet template example and I could see the official tutorial, too, in both cases I can see the tuts make using <ui:composition template="/layout.xhtml"> with template support only; But is there a way not to include template if I want some a very simple facelet for example?

I tried to ignore the template attribute but then I have java.lang.StackOverflowError being thrown :( So the jsf 2.0 makes me to have templates to be included anyway...

So my question is... is there a way writing facelets without templates references?

Thanks

Foi útil?

Solução

Yes, certainly. Just use the same XHTML composition as the master template /layout.xhtml itself, but then without any <ui:insert>. Instead, just put the desired content straight in there.

For example, /page.xhtml:

<!DOCTYPE html>
<html lang="en"
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
        <title>Some title</title>
    </h:head>
    <h:body>
        <h1>Some heading</h1>
        <p>Plain Facelets page without template!</p>
    </h:body>
</html>

Open this directly as /page.xhtml in browser.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top