[RESOLVIDO] Não consigo validar o xml e a página fica em branco [JSF2]

3 respostas
A

Oi gente, estou enfrentando um problema bem chato. Eu sei que o código funciona, mas eu alterei a estrutura de pastas e algumas configurações que não influenciam na visualização final, então creio eu que o problema seja no xml que não está validando de jeito nenhum.

essa é a página que não valida:
<ui:composition template="http://localhost:8080/Padrao/template/modelo.xhtml"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.prime.com.tr/ui">
    <ui:define name="estilos">
        <link rel="stylesheet" media="all" href="../resources/css/adiciona.css"/>
    </ui:define>
    <ui:define name="menu">
        <ui:include src="../modelos/menu.xhtml"/>
    </ui:define>
    <ui:define name="conteudo">
        <p:panel header="Adicionar Nova Demanda" styleClass="painel">
            <h:form styleClass="fomulario">
                <h:panelGrid columns="2">
                    <h:panelGroup styleClass="htitulo">
                        <h:outputLabel value="Título" for="tx_titulo"/><br/>
                        <p:inputText id="tx_titulo" value="${controle.titulo}" styleClass="tx_titulo"/>
                    </h:panelGroup>

                    <h:panelGroup>
                        <h:outputLabel value="Data" for="tx_data"/><br/>
                        <p:calendar id="tx_data" value="${controle.data}"/>
                    </h:panelGroup>
                </h:panelGrid>

                <h:outputLabel value="Descrição" for="ta_descricao"/><br/>
                <p:inputTextarea id="ta_descricao" value="${controle.descricao}" styleClass="ta" rows="5"/>

                <h:outputLabel value="Prazo" for="tx_prazo"/><br/>
                <p:calendar id="tx_prazo" value="${controle.prazo}"/>

                <h:panelGrid columns="1">
                    <h:outputLabel value="Classificação" for="cb_classifica"/>
                    <h:selectOneMenu id="cb_classifica" value="${controle.classificacao}">
                        <f:selectItem itemValue="Projeto" itemLabel="Projeto       "/>
                        <f:selectItem itemValue="Opção 2" itemLabel="Opção 2"/>
                        <f:selectItem itemValue="Opção 3" itemLabel="Opção 3"/>
                    </h:selectOneMenu>
                    <h:outputLabel value="Status" for="cb_status"/>
                    <h:selectOneMenu id="cb_status" value="${controle.status}">
                        <f:selectItem itemValue="Cancelado" itemLabel="Cancelado"/>
                        <f:selectItem itemValue="Finalizado" itemLabel="Finalizado"/>
                        <f:selectItem itemValue="Pendente" itemLabel="Pendente"/>
                    </h:selectOneMenu>
                </h:panelGrid>
                <p:commandButton value="Salvar"/>
            </h:form>
        </p:panel>
    </ui:define>
</ui:composition>
e esse é o modelo (funcionando) que está sendo utilizado:
<?xml version="1.0" encoding="UTF-8"?>
<!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:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <title>Diretoria de Varejo</title>
        <link rel="stylesheet" href="http://localhost:8080/Padrao/scripts/css/intranet.css" media="all"/>
        <link rel="stylesheet" href="http://localhost:8080/Padrao/scripts/css/tema.css" media="all"/>
        <ui:insert name="estilos"></ui:insert>
    </h:head>
    <h:body>
        <!-- Cabeçalho -->
        <h:panelGroup id="container-top">
            <h:panelGroup id="logo">
                <a href="#"><img src="http://localhost:8080/Padrao/imagens/cabecalho/logo.jpg"/></a>
            </h:panelGroup>
            <h:panelGroup id="slogan">
                <img src="http://localhost:8080/Padrao/imagens/cabecalho/intranet.gif"/><br/>
                <h:outputText value="CARLOS 2.0"/>
            </h:panelGroup>
            <h:panelGroup id="atalhos">
                <h:outputLink value="#" target="_blank" title="Seu Trabalho"><img src="http://localhost:8080/Padrao/imagens/cabecalho/seu_trabalho.png"/></h:outputLink>
                <h:outputLink value="#" target="_blank" title="O Banco do Brasil"><img src="http://localhost:8080/Padrao/imagens/cabecalho/o_bb.png"/></h:outputLink>
                <h:outputLink value="#" target="_blank" title="Vida e Carreira"><img src="http://localhost:8080/Padrao/imagens/cabecalho/vida_e_carreira.png"/></h:outputLink>
            </h:panelGroup>
            <h:panelGroup id="links">
                <h:panelGrid columns="4">
                    <h:panelGroup><h:outputLink value="#" target="_blank">Sistema</h:outputLink> |</h:panelGroup>
                    <h:panelGroup><h:outputLink value="#" target="_blank">Correio</h:outputLink> |</h:panelGroup>
                    <h:panelGroup><h:outputLink value="#" target="_blank">Sua Conta</h:outputLink> |</h:panelGroup>
                    <h:panelGroup><h:outputLink value="#">Sair</h:outputLink> &nbsp;</h:panelGroup>
                </h:panelGrid>
            </h:panelGroup>
        </h:panelGroup>

        <!-- Corpo -->
        <h:panelGroup id="container-corpo">
            <h:panelGroup id="menu">
                <ui:insert name="menu">
                    Menu
                </ui:insert>
            </h:panelGroup>
            <h:panelGrid columns="2">
                <f:verbatim>&nbsp;</f:verbatim>
                <h:panelGroup id="conteudo">
                    <ui:insert name="conteudo">
                        Conteúdo
                    </ui:insert>
                </h:panelGroup>
            </h:panelGrid>
            <h:panelGroup id="rodape">
                Vem pra cá ? Xumbrega
            </h:panelGroup>
        </h:panelGroup>

    </h:body>
</html>
a mensagem que aparece ao validar é essa:
Verificando file:/C:/Users/f1831049/Documents/NetBeansProjects/SGD/web/paginas/adiciona.xhtml...
cvc-elt.1: Cannot find the declaration of element 'ui:composition'. [6] 
Validação do XML concluída.

qq eu faço com essa droga??? o.O

3 Respostas

A

outra mensagem que aparece de vez em quando é esta:Document root element "ui:composition", must match DOCTYPE root "composition". [8]

Polverini

o que pode estar ocorrendo é a url da pagina estar errada, eu uso assim

<ui:composition template="/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">
A

não postei de volta, mas consegui fazer funcionar, o xml não está corretamente validado, porém funciona. :lol:
o problema era burrice mesmo ^^
eu defini o padrão para .fac, então ao tentar executar o .xhtml ele encontrava a sequência da página, porém ele só abriria corretamente se eu colocasse a página.fac, aí funcionou

Criado 11 de março de 2011
Ultima resposta 14 de mar. de 2011
Respostas 3
Participantes 2