Calendar primefaces não funciona dentro de template [RESOLVIDO]

3 respostas
F

Olá galera do GUJ!

Estou tendo um problema com o componente . Estou fazendo uns Hello Wolrd da vida pra ver como é trabalhar com Prime Faces, estava tudo dando certo até eu tentar trabalhar com templates.
Desta forma não funciona, aparece apenas uma caixa de texto, não abre o calendario na tela:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<ui:composition template="/pages/templates/master.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.prime.com.tr/ui">
	<ui:define name="title">Vigie me - Seja bem vindo!</ui:define>
	<ui:define name="content">
		<h:form>
			<p:calendar value="#{homeController.date}" />
		</h:form>
	</ui:define>
</ui:composition>

Se eu retiro o template e trabalho com



conteudo


funciona de boa.

Segue 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:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.prime.com.tr/ui" >
<head>
<title><ui:insert name="title">Vigie me</ui:insert></title>
</head>

<body>
<f:view contentType="text/html">
	<div id="header">
		<ui:insert name="header">
    	
		MENU ENTRA AQUI <br /> <br />
		</ui:insert>
	</div>


	<div id="content">
		<ui:insert name="content">
    	
		</ui:insert>
	</div>

	<div id="footer">
		<ui:insert name="footer">
		<br/><br/>
    	NOME DA EMPRESA E TALS
		</ui:insert>
	</div>
</f:view>
</body>

</html>
e o bean:
package br.com.vigieme.controller;

import java.util.Date;

import javax.faces.bean.ManagedBean;

@ManagedBean
public class HomeController {
	private Date date;

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

}

Alguem pode me ajudar nessa?

3 Respostas

A

no deu template, ao invés de utilizar utilize <h:body> e ao invés de utilize <h:header>
atenção na hora da composição rapaz :smiley:

A
<?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:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html">
    <h:head>
        <title>
            <ui:insert name="titulo_pagina" >Sistema de Nota Fiscal Eletrônica - SNFE.</ui:insert>
        </title>
        <link type="text/css" rel="stylesheet" href="resources/css/style.css" />
    </h:head>

    <h:body>
        <div id="header">
            <ui:insert name="header">

		MENU ENTRA AQUI <br /> <br />
            </ui:insert>
        </div>


        <div id="content">
            <ui:insert name="content">

            </ui:insert>
        </div>

        <div id="footer">
            <ui:insert name="footer">
                <br/><br/>
    	NOME DA EMPRESA E TALS
            </ui:insert>
        </div>
    </h:body>

</html>
<?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 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <f:view contentType="text/html" />
    <h:body>
        <ui:composition template="/master.xhtml">
            <ui:define name="title">Vigie me - Seja bem vindo!</ui:define>
            <ui:define name="content">
                <h:form>
                    <p:calendar value="#{homeController.date}" />
                </h:form>
            </ui:define>
        </ui:composition>
    </h:body>
</html>
F

Obrigado andre.froes, era só este detalhe mesmo

Qndo eu criei o template no eclipse ele já veio assim, nem me atentei a este detalhe.

Valeu pela ajuda!

Criado 5 de agosto de 2011
Ultima resposta 5 de ago. de 2011
Respostas 3
Participantes 3