Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <h:form>
- <table>
- <tr>
- <td><label>First Name:</label></td>
- <td><h:outputText value="#{profile.firstName}"
- rendered="#{not profile.canEdit}" /></td>
- <td><h:inputText value="#{profile.firstName}"
- rendered="#{profile.canEdit}" required="true" /></td>
- <td><h:commandButton value="Edit"
- action="#{profile.editDetail}" /></td>
- <td><h:commandButton value="Cancel" type="button"
- action="#{profile.cancelBtn}" /></td>
- </tr>
- <tr>
- <td><label>Last Name:</label></td>
- <td><h:outputText value="#{profile.lastName}"
- rendered="#{not profile.canEdit}" /></td>
- <td><h:inputText value="#{profile.lastName}"
- rendered="#{profile.canEdit}" required="true" /></td>
- <td><h:commandButton value="Edit"
- action="#{profile.editDetail}" /></td>
- <td><h:commandButton value="Cancel" type="button"
- action="#{profile.cancelBtn}" /></td>
- </tr>
- <tr>
- <td><label>Email:</label></td>
- <td><h:outputText value="#{profile.email}"
- rendered="#{not profile.canEdit}" /></td>
- <td><h:inputText value="#{profile.email}" id="email"
- rendered="#{profile.canEdit}" required="true" /></td>
- <td><h:commandButton value="Edit"
- action="#{profile.editDetail}" /></td>
- <td><h:commandButton value="Cancel" type="button"
- action="#{profile.cancelBtn}" /></td>
- <td><h:message for="email" value="#{profile.errorMessage}"
- rendered="#{profile.errorMessage ne null}" /></td>
- </tr>
- <tr>
- <td><label>Password:</label></td>
- <td><h:outputText value="#{profile.password}"
- rendered="#{not profile.canEdit}" /></td>
- <td><h:commandButton value="Edit"
- action="#{profile.editDetail}" /></td>
- <td><h:commandButton value="Cancel" type="button"
- action="#{profile.cancelBtn}" /></td>
- </tr>
- <h:panelGroup rendered="#{profile.canEdit}">
- <tr>
- <td><label>Old Password: </label></td>
- <td><h:inputText value="#{profile.password}" required="true" /></td>
- <td><h:outputText rendered="#{profile.errorMessage != null}"
- value="#{profile.errorMessage}"></h:outputText></td>
- </tr>
- <tr>
- <td><label>New Password: </label></td>
- <td><h:inputSecret value="#{profile.newPassword}"
- required="true" /></td>
- </tr>
- <tr>
- <td><label>Confirm Password: </label></td>
- <td><h:inputSecret value="#{profile.confirmPassword}"
- required="true" /></td>
- <td><h:outputText
- rendered="#{profile.confirmPassword != profile.newPassword}"
- value="Passwords donot match!!"></h:outputText></td>
- </tr>
- <tr>
- <td><h:commandButton action="#{profile.savePassword}"
- value="Save Password"
- disabled="#{profile.confirmPassword != profile.newPassword}" /></td>
- <td><h:commandButton action="#{profile.cancelBtn}" value="Cancel" type="button"/></td>
- </tr>
- </h:panelGroup>
- <tr>
- <td><label>Gender</label></td>
- <td>#{profile.gender}</td>
- </tr>
- <tr>
- <td><label>City</label></td>
- <td>#{profile.city}</td>
- </tr>
- <tr>
- <td><label>State</label></td>
- <td>#{profile.state}</td>
- </tr>
- <tr>
- <td><label>Country</label></td>
- <td>#{profile.country}</td>
- </tr>
- <tr>
- <td><label>Zip-Code</label></td>
- <td>#{profile.zipCode}</td>
- </tr>
- <tr>
- <td><label>Phone Number</label></td>
- <td>#{profile.phoneNumber}</td>
- </tr>
- <tr>
- <td><h:commandButton action="#{profile.saveDetails}"
- disabled="#{profile.canEdit eq 'false'}" value="Save" /></td>
- <td><h:commandButton action="#{profile.cancelBtn}" type="button"
- value="Cancel" /></td>
- </tr>
- </table>
- </h:form>
- public String InitializeValues(){
- customer = (CustomerVO) sessionManager.getSession("CustomerBean");
- System.out.println("inside profilepagecontroller"+"n"+ customer);
- setFirstName(customer.getFirstName());
- this.setLastName(customer.getLastName());
- this.setEmail(customer.getEmail());
- this.setPassword(customer.getPassword());
- this.setCity(customer.getCity());
- this.setState(customer.getState());
- this.setCountry(customer.getCountry());
- this.setPhoneNumber(customer.getPhoneNumber());
- this.setGender(customer.getGender());
- this.setZipCode(customer.getZipCode());
- this.setCustomerId(customer.getCustomerId());
- return "ProfilePage";
- }
- public String editDetail(){
- setCanEdit(true);
- setCanSave(true);
- return null;
- }
- public String cancelBtn(){
- setCanEdit(false);
- return "ProfilePage";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement