2
respostas

Pass-through Elements

Oi, tentei utilizar o "Pass-through Elements" no meu código, mas o html nao esta reconhecendo como type="email" mais alguém sabe me dizer onde eu errei? Segue codigo:

<?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:jsf="http://xmlns.jcp.org/jsf"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:ui="http://xmlns.jcp.org/jsf/facelets">

    <ui:composition template="_template.xhtml">

        <f:metadata>
            <f:viewParam name="autorId" value="#{autorBean.autor.id}"/>
            <f:viewAction action="#{autorBean.carregaPeloId}" if="#{param.autorId != null}"/>
        </f:metadata>

        <ui:define name="titulo">
                Novo Autor
        </ui:define>

        <ui:define name="conteudo">
            <h:form id="autor">
                <fieldset>
                    <legend>Dados do Autor</legend>
                    <h:panelGrid columns="3">

                        <h:outputLabel value="Nome:" for="nome" />
                        <h:inputText id="nome" value="#{autorBean.autor.nome}"
                            required="true">
                            <f:validateLength minimum="5" />
                            <f:ajax event="blur" render="messageNome" />
                        </h:inputText>

                        <h:message for="nome" id="messageNome" />

                        <h:outputLabel value="Email:" for="email" />
                        <input jsf:type="email" jsf:id="email" jsf:value="#{autorBean.autor.email}" jsf:required="true"/>

                        <h:message for="email" id="messageEmail" />

                        <h:commandButton value="Gravar" action="#{autorBean.gravar}" />
                    </h:panelGrid>
                </fieldset>
            </h:form>

            <h:form id="formTabelaAutores">
                <h:dataTable value="#{autorBean.autores}" var="autor" id="tabelaAutores">
                    <h:column>
                        <f:facet name="header">Nome</f:facet>
                        <h:outputText value="#{autor.nome}" />
                    </h:column>
                    <h:column>
                        <f:facet name="header">Alterar</f:facet>
                        <h:commandLink value="altera" action="#{autorBean.carregar(autor)}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">Remover</f:facet>
                        <h:commandLink value="remove" action="#{autorBean.remover(autor)}"/>
                    </h:column>
                </h:dataTable>
            </h:form>
        </ui:define>

    </ui:composition>

</html>
2 respostas

Oi Lucas,

Tente

 <input type="email"

ao invés de

 <input jsf:type="email"

Abraço!

Funcionou Otávio

Mas desse modo eu ainda estarei utilizando o "Pass-through Elements"?

porque oque ativa ele é o jsf: nao?

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software