Iniciando tuturial JSF pagina rederiza em branco, o que pode ser?

0 respostas
jsfprimefacesjavawebjavajsp
M

Boa noite galera, estou iniciando em jsf e empaquei num erro seguindo o tutorial, mas minha pagina carrega em branco quando clico em gerenciar carros.

Eu sei que o erro está no TEMPLATE

gerenciar-carro.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">
<ui:decorate xmlns="http://www.w3.org/1999/xhtml"
             xmlns:h="http://xmlns.jcp.org/jsf/html"
             xmlns:p="http://primefaces.org/ui"
             xmlns:f="http://xmlns.jcp.org/jsf/core"             
             xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
             template="template.xhtml">

    <h:form>
        <p:toolbar>
            <p:toolbarGroup id="frm">
                <p:commandButton value="Adicionar" action="#{carroBean.adicionar()}" update="frm"></p:commandButton>
            </p:toolbarGroup>
        </p:toolbar>
        <p:fieldset legend="Objetos">
            <p:panelGrid columns="2">
                <h:outputLabel value="Modelo"></h:outputLabel>
                <h:inputText value="#{carroBean.carro.modelo}"></h:inputText>

                <h:outputLabel value="Fabricante"></h:outputLabel>
                <h:inputText value="#{carroBean.carro.fabricante}"></h:inputText>

                <h:outputLabel value="Cor"></h:outputLabel>
                <h:inputText value="#{carroBean.carro.cor}"></h:inputText>

                <h:outputLabel value="Ano"></h:outputLabel>
                <p:inputMask mask="9999" value="#{carroBean.carro.ano}"></p:inputMask>
            </p:panelGrid>
            <p:dataTable value="#{carroBean.carros}" var="carro">
                <p:column headerText="Modelo" sortBy="#{carro.modelo}">
                    <h:outputText value="#{carro.modelo}"></h:outputText>
                </p:column>
                <p:column headerText="Fabricante" sortBy="#{carro.fabricante}">
                    <h:outputText value="#{carro.fabricante}"></h:outputText>
                </p:column>
                <p:column headerText="Cor" sortBy="#{carro.cor}">
                    <h:outputText value="#{carro.cor}"></h:outputText>
                </p:column>
                <p:column headerText="Ano" sortBy="#{carro.ano}">
                    <h:outputText value="#{carro.ano}">
                        <f:convertDateTime pattern="dd/MM/yyyy"></f:convertDateTime>
                    </h:outputText>
                </p:column>
            </p:dataTable>
        </p:fieldset>
    </h:form>
</ui:decorate>

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://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>Sistema Carros</title>
    </h:head>
    <h:body>
        <h1>Sistema de Carros</h1>
        <p:menubar>
            <p:menuitem value="Home" url="index.jsf"></p:menuitem>
            <p:menuitem value="Gerenciar Carros" url="gerenciar-carro.jsf"></p:menuitem>
        </p:menubar>
        <hr/>
        <ui:insert name="corpo"></ui:insert>
    </h: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">
<ui:decorate xmlns="http://www.w3.org/1999/xhtml"
             xmlns:h="http://xmlns.jcp.org/jsf/html"
             xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
             template="template.xhtml">
     
    <ui:define  name="corpo">
        <h1>Bem Vindo ao Sistema</h1>
    </ui:define>
</ui:decorate>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>index.jsf</welcome-file>
    </welcome-file-list>
</web-app>


quando clico em gerenciar carros
renderiza em branco

Criado 27 de abril de 2019
Respostas 0
Participantes 1