Question

I am trying to show a value from the database in a input text to update it. so when I click on the column the program show a window with all the values but as an inputtext so the user can't update the values.

I am using PrimeFace 4, jsf and mysql as a database

<i>
    <h:panelGrid id="display" columns="2" cellpadding="4">
        <h:outputText value="ID:" />
        <h:outputText value="#{usersBean.selectUser.idUtilisateur}"
            style="font-weight:bold" />

        <h:outputText value="Nom:" />
        <h:inputText value="#{usersBean.selectUser.nomUtilisateur}"
            style="font-weight:bold" />

        <h:outputText value="Prenom" />
        <h:inputText value="#{usersBean.selectUser.prenomUtilisateur}"
            style="font-weight:bold" />

        <h:outputText value="Indentifiant" />
        <h:inputText value="#{usersBean.selectUser.identifiUtilisateur}"
            style="font-weight:bold" />
    </h:panelGrid>
<i/>

No correct solution

OTHER TIPS

  1. Any input field should be inside a form (h:form will do) to be processed. You could omit this in case you just want to output the data. But in this case it would be more "correct" to use "output" elements for this task.

  2. Since you use PrimeFaces I would highly recommend using p:inputText (http://www.primefaces.org/showcase/ui/inputText.jsf). It has all the attributes of h:inputText but is more compatible with PF processors.

  3. To show any value inside an inputText you just have to initialize it in the provided managed bean. And of course, if you use partial submit approach don't forget to update the element/container you're trying to show values at.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top