Advertisement
Guest User

Untitled

a guest
May 1st, 2016
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.14 KB | None | 0 0
  1. <h:form>
  2. <table>
  3. <tr>
  4. <td><label>First Name:</label></td>
  5. <td><h:outputText value="#{profile.firstName}"
  6. rendered="#{not profile.canEdit}" /></td>
  7. <td><h:inputText value="#{profile.firstName}"
  8. rendered="#{profile.canEdit}" required="true" /></td>
  9. <td><h:commandButton value="Edit"
  10. action="#{profile.editDetail}" /></td>
  11. <td><h:commandButton value="Cancel" type="button"
  12. action="#{profile.cancelBtn}" /></td>
  13. </tr>
  14. <tr>
  15. <td><label>Last Name:</label></td>
  16. <td><h:outputText value="#{profile.lastName}"
  17. rendered="#{not profile.canEdit}" /></td>
  18. <td><h:inputText value="#{profile.lastName}"
  19. rendered="#{profile.canEdit}" required="true" /></td>
  20. <td><h:commandButton value="Edit"
  21. action="#{profile.editDetail}" /></td>
  22. <td><h:commandButton value="Cancel" type="button"
  23. action="#{profile.cancelBtn}" /></td>
  24. </tr>
  25. <tr>
  26. <td><label>Email:</label></td>
  27. <td><h:outputText value="#{profile.email}"
  28. rendered="#{not profile.canEdit}" /></td>
  29. <td><h:inputText value="#{profile.email}" id="email"
  30. rendered="#{profile.canEdit}" required="true" /></td>
  31. <td><h:commandButton value="Edit"
  32. action="#{profile.editDetail}" /></td>
  33. <td><h:commandButton value="Cancel" type="button"
  34. action="#{profile.cancelBtn}" /></td>
  35. <td><h:message for="email" value="#{profile.errorMessage}"
  36. rendered="#{profile.errorMessage ne null}" /></td>
  37. </tr>
  38. <tr>
  39. <td><label>Password:</label></td>
  40. <td><h:outputText value="#{profile.password}"
  41. rendered="#{not profile.canEdit}" /></td>
  42. <td><h:commandButton value="Edit"
  43. action="#{profile.editDetail}" /></td>
  44. <td><h:commandButton value="Cancel" type="button"
  45. action="#{profile.cancelBtn}" /></td>
  46. </tr>
  47. <h:panelGroup rendered="#{profile.canEdit}">
  48.  
  49. <tr>
  50. <td><label>Old Password: </label></td>
  51. <td><h:inputText value="#{profile.password}" required="true" /></td>
  52. <td><h:outputText rendered="#{profile.errorMessage != null}"
  53. value="#{profile.errorMessage}"></h:outputText></td>
  54. </tr>
  55. <tr>
  56. <td><label>New Password: </label></td>
  57. <td><h:inputSecret value="#{profile.newPassword}"
  58. required="true" /></td>
  59. </tr>
  60. <tr>
  61. <td><label>Confirm Password: </label></td>
  62. <td><h:inputSecret value="#{profile.confirmPassword}"
  63. required="true" /></td>
  64. <td><h:outputText
  65. rendered="#{profile.confirmPassword != profile.newPassword}"
  66. value="Passwords donot match!!"></h:outputText></td>
  67. </tr>
  68. <tr>
  69. <td><h:commandButton action="#{profile.savePassword}"
  70. value="Save Password"
  71. disabled="#{profile.confirmPassword != profile.newPassword}" /></td>
  72. <td><h:commandButton action="#{profile.cancelBtn}" value="Cancel" type="button"/></td>
  73. </tr>
  74.  
  75. </h:panelGroup>
  76. <tr>
  77. <td><label>Gender</label></td>
  78. <td>#{profile.gender}</td>
  79. </tr>
  80. <tr>
  81. <td><label>City</label></td>
  82. <td>#{profile.city}</td>
  83. </tr>
  84. <tr>
  85. <td><label>State</label></td>
  86. <td>#{profile.state}</td>
  87. </tr>
  88. <tr>
  89. <td><label>Country</label></td>
  90. <td>#{profile.country}</td>
  91. </tr>
  92. <tr>
  93. <td><label>Zip-Code</label></td>
  94. <td>#{profile.zipCode}</td>
  95. </tr>
  96. <tr>
  97. <td><label>Phone Number</label></td>
  98. <td>#{profile.phoneNumber}</td>
  99. </tr>
  100. <tr>
  101. <td><h:commandButton action="#{profile.saveDetails}"
  102. disabled="#{profile.canEdit eq 'false'}" value="Save" /></td>
  103. <td><h:commandButton action="#{profile.cancelBtn}" type="button"
  104. value="Cancel" /></td>
  105. </tr>
  106. </table>
  107. </h:form>
  108.  
  109. public String InitializeValues(){
  110.  
  111.  
  112. customer = (CustomerVO) sessionManager.getSession("CustomerBean");
  113. System.out.println("inside profilepagecontroller"+"n"+ customer);
  114. setFirstName(customer.getFirstName());
  115. this.setLastName(customer.getLastName());
  116. this.setEmail(customer.getEmail());
  117. this.setPassword(customer.getPassword());
  118. this.setCity(customer.getCity());
  119. this.setState(customer.getState());
  120. this.setCountry(customer.getCountry());
  121. this.setPhoneNumber(customer.getPhoneNumber());
  122. this.setGender(customer.getGender());
  123. this.setZipCode(customer.getZipCode());
  124. this.setCustomerId(customer.getCustomerId());
  125.  
  126. return "ProfilePage";
  127.  
  128. }
  129.  
  130.  
  131.  
  132. public String editDetail(){
  133. setCanEdit(true);
  134. setCanSave(true);
  135. return null;
  136. }
  137.  
  138. public String cancelBtn(){
  139. setCanEdit(false);
  140. return "ProfilePage";
  141. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement