Primefaces component not rendered as expected

1

As you can see in the image below, the text input field is not in the firstfaces layout. Does anyone know how I can resolve?

Belowisnowmy.xhtmlfile:

<!DOCTYPEhtmlPUBLIC"-//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:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui">
        <h:panelGroup id="cadastro">
            <h:form id="cad">
                <p:panel>
                    <h:outputText value="Cadastro de Habilidades"
                        style="font-size:18px;fontweight:bold" />
                    <p:messages />
                    <p:panelGrid columns="3" styleClass="ui-noborder">
                        <p:outputLabel value="Nome " />
                        <p:inputText id="nome" value="#{habilidademb.habilidade.nome}" size="50" />
                        <p:message for="nome" errorClass="invalid" />
                        </p:panelGrid>
                </p:panel>
            </h:form>
        </h:panelGroup>
</html>

The driver is in Maven dependencies.

    
asked by anonymous 20.05.2016 / 17:06

1 answer

1

Douglas,

Your XHTML page starts with the h: panelGroup component before form :

<h:panelGroup id="cadastro">

I suggest that you put the form as the first element and only use native components of Primefaces, in your case I would change your code to something like this:

<h:form id="formCadastro">
    <p:panel id="cadastro">
        <p:outputLabel value="Cadastro de Habilidades" />

        <p:messages/>   

        <p:panelGrid columns="3" styleClass="ui-noborder">
            <p:outputLabel value="Nome " />
            <p:inputText id="nome" value="#{habilidademb.habilidade.nome}" size="50" />
            <p:message for="nome" errorClass="invalid" />
        </p:panelGrid>
    </p:panel>
</h:form>

What does the ui-noborder style class of the code below?

<p:panelGrid columns="3" styleClass="ui-noborder">

Be careful because depending on what is in this class there is a possibility that the style of your text field will be overwritten by other rules that have higher priority.

Do you use theme? Is it working with other components? Send more details so people can better understand your problem and who better know how to help you.

I hope this helps ...

Good luck!

    
21.10.2016 / 15:46