FACELETS + CSS duvida

1 resposta
G

eis o cenario, estou estruturando o template q vai ser usado por um app, vou utilizar o facelets, a estrutura é a seguinte:

:arrow: cabealho
:arrow: futuramente um menu
:arrow: conteudo
:arrow: rodape

esse é o template
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets">
  <head>
    <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
    <link href="#{facesContext.externalContext.request.contextPath}/css/myStyle.css"
          rel="stylesheet" type="text/css"/>
  </head>
  <body>
    <div id="corpo">
      <ui:insert name="geral"></ui:insert>
       
      <div id="cabecalho">
        <ui:insert name="cabecalho"></ui:insert>
      </div>
    </div>
  </body>
</html>
esse é o css
#cabecalho{     
    margin-top: 0px;    
    background: red;    
    height: 10em;
}
#corpo {    
    border: 1px solid Black ;
    margin: 0 auto;
    width: 768px;
}
e essa é a pagina q utilizara o template
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html">
  <head></head>
  <body>
    <ui:composition template="template.xhtml">
      <ui:define name="geral">
        <ui:define name="cabecalho"></ui:define>
        <h:outputText value="teste"/>
      </ui:define>
    </ui:composition>
  </body>
</html>

qnd executo, ele printa na tela o ou qqlr outro valor antes do cabecalho, quebrando a estrutura mencionada acima ...

alguem ja teve esse problema com facelets? como eu resolvo ?

pq isso acontece?

1 Resposta

rponte

Acredito que você não pode utilizar a tag ui:define dentro de outra ui:define.

Tente algo como:

&lt;ui:composition template="template.xhtml"&gt; &lt;ui:define name="geral"&gt; &lt;h:outputText value="teste"/&gt; &lt;/ui:define&gt; &lt;ui:define name="cabecalho"&gt;&lt;/ui:define&gt; &lt;/ui:composition&gt;

Criado 18 de fevereiro de 2009
Ultima resposta 18 de fev. de 2009
Respostas 1
Participantes 2