0

Below is the form detail for the employee. An update button is provided, when (I want to achieve) clicking converts all the form components to editable with pre-filled data taken from the employee already written in the text fields and Save button refeshed the page with the updated details. How can I do that. I am using JSF 2.

details.xhtml

<!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: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></h:head> 
<body> 

<h:form id="form1" prependId="false">
    <h:panelGrid columns="1">
        <h:panelGroup>
        <h:graphicImage library="images" name="images.jpg"/>
        </h:panelGroup>

        <h:panelGroup>
        <h:outputLabel for="name" value="Name" />
        <h:outputText id="name" value="#{employeeManagedBean.name}" />
        </h:panelGroup>

        <h:panelGroup>
        <h:outputLabel for="cnic" value="CNIC" />
        <h:outputText id="cnic" value="#{employeeManagedBean.cnic}" />
        </h:panelGroup>

        <h:panelGroup>
        <h:outputLabel for="contact_number" value="Contact Number" />
        <h:outputText id="contact_number" value="#{employeeManagedBean.contactNumber}" />
        </h:panelGroup>         

        <h:panelGroup>
        <h:outputLabel for="dob" value="Date of Birth" />
        <h:outputText id="dob" value="#{employeeManagedBean.dob}" />
        </h:panelGroup>

        <h:panelGroup>
        <h:outputLabel for="email_address" value="Email" />
        <h:outputText id="email_address" value="#{employeeManagedBean.emailAddress}" />
        </h:panelGroup>

        <h:panelGroup>
        <h:outputLabel for="password" value="Password" />
        <h:outputText id="password" value="#{employeeManagedBean.password}" />
        </h:panelGroup>

        <h:panelGroup>
        <h:commandButton value="Update"/>
        <h:commandButton value="Save"/>
        </h:panelGroup>

    </h:panelGrid>
</h:form>
</body> 
</html>
Kukeltje
  • 12,223
  • 4
  • 24
  • 47
Imam Bux
  • 1,006
  • 11
  • 27
  • Set a boolean on Update button click, hide labels and render input components based on that boolean property. – Parkash Kumar May 12 '15 at 06:39
  • 1
    @parkashkumar: that is exactly what the duplicate post states. Better to vote for it as a duplicate of that to. – Kukeltje May 12 '15 at 07:17

0 Answers0