Set variable value in Inputtext JSF

Asked

Viewed 993 times

0

Guys, I’m having a doubt maybe a little bit stupid but I’m not able to solve, I’m starting web development using java and jsf, primefaces and I have a problem at the time of changing a record. I have a listing page that contains the detail button from there I open a

<p:dialog header="Detalhamento de Turmas" widgetVar="turmaDialog" modal="true" showEffect="explode" hideEffect="explode" resizable="false">

And inside I list my data:

 <p:outputPanel id="turmaDetail" style="text-align:center;">
        <p:panelGrid  columns="2" columnClasses="label,value"> 

            <h:outputText value="Código da Turma" />
            <h:outputText value="#{controllerTurma.turmaAlterar.id}" />
            <h:outputText value="Nome / Descrição" />
            <h:outputText value="#{controllerTurma.turmaAlterar.descricao}" />
            <h:outputText value="Tipo Ensino" />
            <h:outputText value="#{controllerTurma.turmaAlterar.tipoEnsino}" />
            <h:outputText value="Turno das Aulas" />
            <h:outputText value="#{controllerTurma.turmaAlterar.turno}"/>                                              
            <center>
            <p:commandButton ajax="false" value="Alterar"/>
            </center>

        </p:panelGrid>
    </p:outputPanel>

my problem is, when trying to do the same, but passing the values to a

   <h:inputText value="#{controllerTurma.turmaAlterar.descricao}"  />

the input is empty, as if the value of the variable was null, but the same value is being listed there above. What should I do to load my data into an inputText

  • I commented, I ended up deleting, but I will comment again. gets until arriving in description, no? I know it is silly the question even more that worked in a outputText, but only to ease my conscience.

  • Gustavo, sorry I don’t quite understand what you want to know :/

  • But honestly I don’t know why it doesn’t work, this is what should actually happen...

  • You have the methods get, with which the Expression Language can make reflection and take the description value? That is, within controllerTurma, you have getTurmaAlterar() and within turmaAlterar you have getDescricao?

  • Hm weird, I hadn’t formatted the question correctly, sorry.

  • Yes I have, the problem there is that to set the value that is in outputtext in an inputtext I’m not getting, the why I’m not understanding

  • This shouldn’t be a problem, really. Once I get home from work I’ll try to recreate the problem. Until then, please leave the codes of the other components, please bean and class.

  • So, I believe that the problems do not come from the bean or the entity class, because I can access them normally, my problem is only to set their value in an Input, including I have a datatable listing these data, however, when passing to a simple text field it is null.

  • Doing some tests here I ended up seeing a possible error, actually the results are being listed, after putting in the input the attribute disabled=true the value is set

Show 4 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.