Frames e JSF [RESOLVIDO]

18 respostas
A

Boa tarde pessoal

Andei pesquisando sobre frames em páginas JSF mas não consegui implementar nada.
Alguém pode me ajudar a implementar dois frames em páginas jsf? No frame esquerdo quero colocar um menu que ao ser clicado abra a respectiva página no frame direito.

Agradeço a atenção

18 Respostas

R

O que vc precisa é algo chamado Facelets.

D

Td q vc precisa é disso:

<iframe></iframe>

O JSF ñ te impede de usar Frames.

R

dev.rafael:
Td q vc precisa é disso:

<iframe></iframe>

O JSF ñ te impede de usar Frames.


frames tem cheiro de 1995 :smiley:

D

Eu ñ disse q se deve usar. E disse é q dá p/ usar! Eu, particularmente, sou mais fã de divs, mas cada um tem o seu gosto. :wink:

R

concordo com o raf4ever, vc precisa utilizar facelets, vc pode criar um template, que vai ter um topo, um menu e uma tela principal e todas as suas paginas seguirão o modelo do template

D

Na verdade facelets ñ tem nada haver com isso, ele é apenas um framework de templates ñ de layout. Vc pode muito bem desenvolver um sistema web sem facelets e sem frames. Facelets ñ é uma solução p/ os layouts baseados em frames. Ele é uma solução, mas p/ outra coisa.

A

Pessoal, acho que não me expressei direito.

Abaixo tem um modelo de template.
<?xml version='1.0' encoding='UTF-8' ?>

<!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:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">

    <h:head>

    </h:head>

    <h:body style="font-size: 10pt">

        <h:form>

            <p:layout fullPage="true" >

                <p:layoutUnit  position="top" height="100" style="border-bottom-style: ridge"  header="TOPO DO TEMPLATE" >
                </p:layoutUnit>

                <p:layoutUnit position="left" width="250" header="Lado Esquerdo" style="border-bottom-style: ridge">
                          <p:calendar mode="inline" />
                </p:layoutUnit>

                <p:layoutUnit position="center" width="250" header="Centro" style="border-bottom-style: ridge">
                </p:layoutUnit>


                <p:layoutUnit position="right" width="150" header="Lado Direito" style="border-bottom-style: ridge">
               
                </p:layoutUnit>


            </p:layout>
        </h:form>
    </h:body>

</html>

O problema é que eu não sei como usar, preciso colocar a página menu.xhtml no LADO ESQUERDO e a página home.xhtml no CENTRO. No menu.xhtml existem botões que abrem outras páginas, gostaria que estas páginas abrissem no CENTRO também.

Obrigado pela atenção

A
asandro1501:
Pessoal, acho que não me expressei direito. Abaixo tem um modelo de template.
<?xml version='1.0' encoding='UTF-8' ?>

<!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:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">

    <h:head>

    </h:head>

    <h:body style="font-size: 10pt">

        <h:form>

            <p:layout fullPage="true" >

                <p:layoutUnit  position="top" height="100" style="border-bottom-style: ridge"  header="TOPO DO TEMPLATE" >
                </p:layoutUnit>

                <p:layoutUnit position="left" width="250" header="Lado Esquerdo" style="border-bottom-style: ridge">
                          <p:calendar mode="inline" />
                </p:layoutUnit>

                <p:layoutUnit position="center" width="250" header="Centro" style="border-bottom-style: ridge">
                </p:layoutUnit>


                <p:layoutUnit position="right" width="150" header="Lado Direito" style="border-bottom-style: ridge">
               
                </p:layoutUnit>


            </p:layout>
        </h:form>
    </h:body>

</html>

O problema é que eu não sei como usar, preciso colocar a página menu.xhtml no LADO ESQUERDO e a página home.xhtml no CENTRO. No menu.xhtml existem botões que abrem outras páginas, gostaria que estas páginas abrissem no CENTRO também.

Obrigado pela atenção

Olá pessoal

Alguma sujestão?

Obrigado

R

tem várias formas de fazer, vc pode fazer o seguinte:

1: bom o menu vai incluir no proprio template , no menu vai ter links e tals e ui:composition

<!-- este cara vai no lado esquerdo left -->
<ui:include src="menu.xhtml" >

ps.: o que for comum para todas as páginas vc coloca no proprio template

2: todas as paginas usaram o template e vc só mudará o centro.

ps2.: vc pode usar framework em java com ajax para mudar as páginas sem dar um refresh na página toda, assim vc ganha mais performance. Richfaces, jsf2 , ajax4jsf bom vc tem que ver qual melhor se aplica em sua situação.

A

Então são as páginas que recebem o template e não o template que recebe as páginas?

R

sim, as páginas tipo usuario.xhtml é que no cabeçalho dele vai ter o nome do template de sua aplicação

ex.:

<ui:composition
    xmlns:ui="http://java.sun.com/jsf/facelets"
    template="./template.xhtml"          <!------------------------ isto aqui informa qual o template vc vai usar para esta pagina ------------------------------->
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:jfx="http://code.google.com/p/javafx4jsf/"
    xmlns:f="http://java.sun.com/jsf/core">

ps.: No caso do menu não precisa ok.

A

Valeu pela ajuda até agora, só não entendi como fazer para que o conteúdo das outras página apareça no centro.

template.xhtml
<?xml version='1.0' encoding='UTF-8' ?>

<!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:h="http://java.sun.com/jsf/html" xmlns:p="http://primefaces.prime.com.tr/ui"

      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">

    <h:head>
        <title><ui:insert name="title">SISP - Sistema Integrado de Saúde Pública</ui:insert></title>
    </h:head>
    <h:body style="font-size: 10pt">

        <h:form>
            <p:layout fullPage="true" >

                <p:layoutUnit  position="top" height="50"   header="TOPO DO TEMPLATE" >
                </p:layoutUnit>

                <p:layoutUnit position="left" width="250"  header="Menu" >
                    <ui:include src="menu.xhtml"/>
                </p:layoutUnit>

                <p:layoutUnit position="center"  header="Centro" >
                </p:layoutUnit>


                <p:layoutUnit position="right" width="200" header="Lado Direito" >
                    <p:calendar mode="inline"/>
                </p:layoutUnit>

            </p:layout>
        </h:form>
    </h:body>
</html>
menu.xhtml
<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core">
    <body>
        <h:form id="form">
            <h3>Menu</h3>
            <p:menu style="width:200px">
                <p:submenu label="Pacientes">
                    <p:menuitem value="Cadastro" icon="/img/paciente16.png" url="InserePaciente.jsf"/>
                    <p:menuitem value="Busca" icon="/img/busca16.png" url="BuscaPaciente.jsf"/>
                </p:submenu>
            </p:menu>
        </h:form>

    </body>
</html>
index.xhtml
<?xml version='1.0' encoding='UTF-8' ?>

<!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:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core">

    <h:head>
        <ui:composition template="template.xhtml"/>
    </h:head>

</html>
InserePaciente.xhtml
<?xml version='1.0' encoding='UTF-8' ?>
<!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:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">
 
    <h:body>
        <h:form >

            <p:panel closable="true"  footer="Cadastro" header="Cadastro Pacientes" style="width: 550PX">
                <p:messages />
                <h:panelGrid columns="2"  cellspacing="15%">

                    <h:outputText value="Nome: "/>
                    <h:inputText value="#{pacienteBean.paciente.nomePaciente}" style="width: 350PX" required="true" requiredMessage="Campo [Nome] obrigatório"/>

                    <h:outputText value="RG "/>
                    <h:inputText value="#{pacienteBean.paciente.rg}" required="true" requiredMessage="Campo [RG] obrigatório"/>

                    <h:outputText value="CPF "/>
                    <h:inputText value="#{pacienteBean.paciente.cpf}"  required="true" requiredMessage="Campo [CPF] obrigatório"/>

                    <h:outputText value="Nascimento: "/>
                    <p:calendar pattern="dd/MM/yyyy" readOnlyInputText="true"  value="#{pacienteBean.paciente.dataNacimento}" />


                    <h:outputText value="Endereço: "/>
                    <h:inputText value="#{pacienteBean.paciente.endereco}" style="width: 350PX" required="true" requiredMessage="Campo [Endereço] obrigatório"/>

                    <h:outputText value="Cidade: "/>
                    <h:inputText value="#{pacienteBean.paciente.cidade}" style="width: 350PX" required="true" requiredMessage="Campo [Cidade] obrigatório"/>

                    <h:outputText value="Estado:"/>
                    <h:inputText value="#{pacienteBean.paciente.estado}"  maxlength="2" style="width: 50PX" required="true" requiredMessage="Campo [Estado] obrigatório"/>
                    <h:commandButton value="Salvar"  action="#{pacienteBean.gravaPaciente}" title="Salvar Paciente" style="width: 100PX" />
                </h:panelGrid>

            </p:panel>
        </h:form>
        <br></br><br></br>
        <h:form>
            <p:panel style="width: 200PX">
                <h:commandButton action="ListaPaciente.jsf"  value="Lista de Pacientes"/>
            </p:panel>
        </h:form>
    </h:body>
</html>

Você pode me mostrar como ficaria o código da página InserePaciente.xhtml para que apareça no centro?

Obrigado mais uma vez

R

blz, mas olha já que seu template tem <html … os outros não precisam

ele vai ficar mais ou menos assim, vc precisa colocar a taglib do -> p: <-

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                template="./template.xhtml">
    
   
    <ui:define name="center">
        <h:body>
         <h:form >

              <p:panel closable="true"  footer="Cadastro" header="Cadastro Pacientes" style="width: 550PX">
                  <p:messages />
                  <h:panelGrid columns="2"  cellspacing="15%">

                      <h:outputText value="Nome: "/>
                      <h:inputText value="#{pacienteBean.paciente.nomePaciente}" style="width: 350PX" required="true" requiredMessage="Campo [Nome] obrigatório"/>

                      <h:outputText value="RG "/>
                      <h:inputText value="#{pacienteBean.paciente.rg}" required="true" requiredMessage="Campo [RG] obrigatório"/>

                      <h:outputText value="CPF "/>
                      <h:inputText value="#{pacienteBean.paciente.cpf}"  required="true" requiredMessage="Campo [CPF] obrigatório"/>

                      <h:outputText value="Nascimento: "/>
                      <p:calendar pattern="dd/MM/yyyy" readOnlyInputText="true"  value="#{pacienteBean.paciente.dataNacimento}" />


                      <h:outputText value="Endereço: "/>
                      <h:inputText value="#{pacienteBean.paciente.endereco}" style="width: 350PX" required="true" requiredMessage="Campo [Endereço] obrigatório"/>

                      <h:outputText value="Cidade: "/>
                      <h:inputText value="#{pacienteBean.paciente.cidade}" style="width: 350PX" required="true" requiredMessage="Campo [Cidade] obrigatório"/>

                      <h:outputText value="Estado:"/>
                     <h:inputText value="#{pacienteBean.paciente.estado}"  maxlength="2" style="width: 50PX" required="true" requiredMessage="Campo [Estado] obrigatório"/>
                      <h:commandButton value="Salvar"  action="#{pacienteBean.gravaPaciente}" title="Salvar Paciente" style="width: 100PX" />
                  </h:panelGrid>

              </p:panel>
          </h:form>
          <br></br><br></br>
          <h:form>
              <p:panel style="width: 200PX">
                  <h:commandButton action="ListaPaciente.jsf"  value="Lista de Pacientes"/>
              </p:panel>
          </h:form>
      </h:body>
    </ui:define>

</ui:composition>

algo mais ou menos assim, vê que no cabeçalho eu não coloquei mais <html …

A

Olá

Inevitavelmente ainda tenho que te incomodar mais um pouco. Alterei os códigos mas tá dando uns erros e ainda não tá aparecendo a página requisitada.

To chamando o template direto agora.

template.xhtml
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">

    <h:head>
        <title><ui:insert name="title">SISP - Sistema Integrado de Saúde Pública</ui:insert></title>
    </h:head>
    <h:body style="font-size: 12pt">

        <h:form>
            <p:layout fullPage="true" >

                <p:layoutUnit  position="top" height="50"   header="TOPO DO TEMPLATE" >
                </p:layoutUnit>

                <p:layoutUnit position="left" width="250"  header="Menu" >
                    <ui:include src="menu.xhtml"/>
                </p:layoutUnit>

                <p:layoutUnit position="center"  header="Centro" >
                </p:layoutUnit>


                <p:layoutUnit position="right" width="200" header="Lado Direito" >
                    <p:calendar mode="inline"/>
                </p:layoutUnit>

            </p:layout>
        </h:form>
    </h:body>
</html>
InserePaciente.xhtml
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                template="template.xhtml">
<body>
    <ui:define name="center">

        <h:form >

            <p:panel closable="false"  footer="Cadastro" header="Cadastro Pacientes" style="width: 550PX">
                <p:messages />
                <h:panelGrid columns="2"  cellspacing="15%">

                    <h:outputText value="Nome: "/>
                    <h:inputText value="#{pacienteBean.paciente.nomePaciente}" style="width: 350PX" required="true" requiredMessage="Campo [Nome] obrigatório"/>

                    <h:outputText value="RG "/>
                    <h:inputText value="#{pacienteBean.paciente.rg}" required="true" requiredMessage="Campo [RG] obrigatório"/>

                    <h:outputText value="CPF "/>
                    <h:inputText value="#{pacienteBean.paciente.cpf}"  required="true" requiredMessage="Campo [CPF] obrigatório"/>

                    <h:outputText value="Nascimento: "/>
                    <p:calendar pattern="dd/MM/yyyy" readOnlyInputText="true"  value="#{pacienteBean.paciente.dataNacimento}" />


                    <h:outputText value="Endereço: "/>
                    <h:inputText value="#{pacienteBean.paciente.endereco}" style="width: 350PX" required="true" requiredMessage="Campo [Endereço] obrigatório"/>

                    <h:outputText value="Cidade: "/>
                    <h:inputText value="#{pacienteBean.paciente.cidade}" style="width: 350PX" required="true" requiredMessage="Campo [Cidade] obrigatório"/>

                    <h:outputText value="Estado:"/>
                    <h:inputText value="#{pacienteBean.paciente.estado}"  maxlength="2" style="width: 50PX" required="true" requiredMessage="Campo [Estado] obrigatório"/>
                    <h:commandButton value="Salvar"  action="#{pacienteBean.gravaPaciente}" title="Salvar Paciente" style="width: 100PX" />
                </h:panelGrid>

            </p:panel>
        </h:form>
        
        <br></br><br></br>

        <h:form>
            <p:panel style="width: 200PX">
                <h:commandButton action="ListaPaciente.jsf"  value="Lista de Pacientes"/>
            </p:panel>
        </h:form>

    </ui:define>
</body>
</ui:composition>
menu.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <body>
        <h:form id="form">
            <p:menu style="width:200px">
                <p:submenu label="Pacientes">
                    <p:menuitem value="Cadastro" icon="/img/paciente16.png" url="InserePaciente.jsf"/>
                    <p:menuitem value="Busca" icon="/img/busca16.png" url="BuscaPaciente.jsf"/>
                    <p:menuitem value="Teste de Chamada" icon="/img/busca16.png" url="teste.jsf" />
                </p:submenu>
            </p:menu>

        </h:form>

    </body>
</ui:composition>
e esse é o erro que tá dando:
Warning: This page calls for XML namespace declared with prefix body but no taglibrary exists for that namespace.

Você tem o título de algum livro que seja bom sobre o assunto?

Obrigado mais uma vez

R

bom aos poucos vamos resolvendo seus problemas. percebi mais alguns:
1- se seu template tem o form, não é recomendado vc colocar //do template do cliente de seu template, ou seja, não pode ter form dentro de form. Ou vc coloca nos clientes do template ou vc coloca no template
2- nos clientes vc tb não precisa da tag , ve só quando a pagina que usa o template é aberta no browser , é como se fosse um arquivo só, tipo o padrão composite view. Uma pagina html é recomendado que tenha apenas uma tag uma tag pois na hora do browser interpretar o código ele pode ou demorar para interpretar ou interpretar de forma errada e se tiver css é que piora tudo, então tem que se ter cuidado na hora de se usar o template e fazer com que no final seja criada uma página html de forma correta.

tenta tirar a tag do menu e do inserePaciente

R

eu estava dando uma pesquisada sobre layouts com o primefaces, e acho que no seu templete esta faltando:

<p:layout fullPage=?true?>	</p:layout>

dá uma olhada neste link e ver se te ajuda:
http://quebrandoparadigmas.wordpress.com/2010/08/06/layouts-no-primefaces/

R

o que vc precisa fazer é unir a forma de layout do primefaces com o composite view do facelets

no seu TEMPLATE.XHTMLvc utiliza vc utiliza o layout do primefaces e onde ficar cada local vc vai colocar:
ex.:

<!-- onde for o topo das páginas -->
<ui:insert name="top">Top</ui:insert>

<!-- onde for o lado esquerdo -->
<ui:insert name="left">Left</ui:insert>

<!-- onde for o centro -->
<ui:insert name="content">Content</ui:insert>

Só lembrando que no facelets vc pode colocar o nome que quizer e pode ir dividindo quantas vezes quizer.

nas páginas cliente do modelo (template ) vc vai fazer:

INSERECLIENTE.XHTML

<!-- onde for o topo do cliente -->
<ui:define name="top">
        
</ui:define>

<!-- a parte esquerda deste cliente -->
    <ui:define name="left">
        
    </ui:define>


<!-- aqui o conteudo do cliente, a parte do centro -->
<ui:define name="content"> </ui:define>

lembrando que se o topo for igual para todos , só precisa no template e a mesma coisa para a parte esquerda ( tipo o menu ) e todos os clientes só precisam do ui:composition

bom qualquer coisa posta ai

A

Boa tarde

Quero agradecer pela sua enorme ajuda.

Andei pesquisando também, e é possível fazer somente com

, esta tag permite configurações como alinhamento, bordas, etc.

Valeu pelas dicas de limpeza dos códigos como os e . Quanto aos , eles são necessários dependendo dos outros componentes utilizados nas páginas como os .

Eu acabei utilizando o layout do primefaces, as tags de referência das páginas e as tags

pra dar uma ajeitada. Não sei se é a melhor maneira de utilizar este conjunto mas agora que eu entendi o que cada um faz ficou bem mais fácil.

Segue abaixo o exemplo dos códigos, espero que ajude alguém com isso.

template.xhtml
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">

    <h:head>
        <title><ui:insert name="title">SISP - Sistema Integrado de Saúde Pública</ui:insert></title>
        <h:outputStylesheet name="styles.css" library="css"/>
    </h:head>
    <h:body style="font-size: 12pt">


        <p:layout fullPage="true" >

            <p:layoutUnit  position="top" height="70"  >
                <div align="center">
                <ui:insert name="top" >
                    <ui:include src="topo.xhtml"/>
                </ui:insert>
                </div>
            </p:layoutUnit>

            <p:layoutUnit position="left" width="250"  header="Menu" >

                <ui:insert name="left">Left
                    <ui:include src="menu.xhtml"/>
                </ui:insert>

            </p:layoutUnit>


            <p:layoutUnit   position="center"  header="Centro" >

                <div align="center" style="border: blue">
                <ui:insert name="content"></ui:insert>
                </div>
            </p:layoutUnit>


            <p:layoutUnit position="right" width="200" header="Lado Direito" >
                <p:calendar mode="inline"/>
            </p:layoutUnit>

        </p:layout>

    </h:body>
</html>
InserePaciente.xhtml - Esta é uma das páginas chamadas pelo menu e deve aparecer no centro do template.
<ui:composition template="template.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets">


    <ui:define name="title"> Cadastro de Paciente </ui:define>

    <ui:define name="content">

            <h:form >

                <p:panel   header="Cadastro Pacientes" style="width: 550PX">
                    <p:messages />
                    <h:panelGrid columns="2"  cellspacing="15%">

                        <h:outputText value="Nome: "/>
                        <h:inputText value="#{pacienteBean.paciente.nomePaciente}" style="width: 350PX" required="true" requiredMessage="Campo [Nome] obrigatório"/>

                        <h:outputText value="RG "/>
                        <h:inputText value="#{pacienteBean.paciente.rg}" required="true" requiredMessage="Campo [RG] obrigatório"/>

                        <h:outputText value="CPF "/>
                        <h:inputText value="#{pacienteBean.paciente.cpf}"  required="true" requiredMessage="Campo [CPF] obrigatório"/>

                        <h:outputText value="Nascimento: "/>
                        <p:calendar pattern="dd/MM/yyyy" readOnlyInputText="true"  value="#{pacienteBean.paciente.dataNacimento}" />


                        <h:outputText value="Endereço: "/>
                        <h:inputText value="#{pacienteBean.paciente.endereco}" style="width: 350PX" required="true" requiredMessage="Campo [Endereço] obrigatório"/>

                        <h:outputText value="Cidade: "/>
                        <h:inputText value="#{pacienteBean.paciente.cidade}" style="width: 350PX" required="true" requiredMessage="Campo [Cidade] obrigatório"/>

                        <h:outputText value="Estado:"/>
                        <h:inputText value="#{pacienteBean.paciente.estado}"  maxlength="2" style="width: 50PX" required="true" requiredMessage="Campo [Estado] obrigatório"/>
                        <h:commandButton value="Salvar"  action="#{pacienteBean.gravaPaciente}" title="Salvar Paciente" style="width: 100PX" />
                    </h:panelGrid>

                </p:panel>
            </h:form>
            <br></br><br></br>
            <h:form>
                <p:panel style="width: 200PX">
                    <h:commandButton action="ListaPaciente.jsf"  value="Lista de Pacientes"/>
                </p:panel>
            </h:form>

    </ui:define>
</ui:composition>
menu.xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets">
    <body>

    <h:form id="form">
        <p:menu style="width:150px">
            <p:submenu label="Pacientes">
                <p:menuitem value="Cadastro" icon="/img/paciente16.png" url="InserePaciente.jsf"/>
                <p:menuitem value="Busca" icon="/img/busca16.png" url="BuscaPaciente.jsf"/>
                <p:menuitem value="Lista" icon="/img/busca16.png" url="ListaPaciente.jsf"/>
            </p:submenu>
        </p:menu>

    </h:form>

</body>
</ui:composition>
topo.xhtml - Esta página só tem um banner e assim como o menu.xhtml ficar sempre fixa no layout
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ui="http://java.sun.com/jsf/facelets">

    
    <img src="img/titulo.png" width="929" align="center" height="61" alt="titulo"/>


</ui:composition>

Obrigado mais uma vez

Vou dar o post como resolvido.

Criado 22 de outubro de 2010
Ultima resposta 26 de out. de 2010
Respostas 18
Participantes 4