Guest User

Untitled

a guest
Jan 4th, 2013
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. <ui:composition template="/WEB-INF/templates/base.xhtml"
  2. xmlns="http://www.w3.org/1999/xhtml"
  3. xmlns:ui="http://java.sun.com/jsf/facelets"
  4. xmlns:h="http://java.sun.com/jsf/html"
  5. xmlns:f="http://java.sun.com/jsf/core"
  6. xmlns:p="http://primefaces.org/ui">
  7. <ui:define name="metadata">
  8. <f:metadata>
  9. <f:event type="preRenderView" listener="#{resetPassword.loadUser}" />
  10. <f:viewParam name="user" value="#{resetPassword.user}" />
  11. </f:metadata>
  12. </ui:define>
  13.  
  14. <ui:define name="content">
  15. <h:form rendered="#{resetPassword.user != null}">
  16. <h:panelGrid class="form_panel" columns="2" width="596px">
  17. <h:outputLabel class="form_label" for="password" value="#{base['resetPassword.password']}" />
  18. <h:inputSecret class="form_inputText" id="password" value="#{resetPassword.password}">
  19. <f:ajax event="keyup" execute="password" listener="#{resetPassword.validatePassword}" render="scorePanel complexity" />
  20. </h:inputSecret>
  21.  
  22. (...) // Other labels and inputfields, no ajax
  23. </h:panelGrid>
  24. </h:form>
  25. </ui:define>
  26. </ui:composition>
  27.  
  28. public void loadUser(ComponentSystemEvent event) {
  29. if(!FacesContext.getCurrentInstance().isPostback()) {
  30. user = (hash != null) ? userService.getByIdAndPwdResetHash(userId, hash) : null;
  31. }
  32. }
  33.  
  34. public void validatePassword(AjaxBehaviorEvent event) {
  35. System.out.println("Ajax works"); // Just for testing purposes so far
  36. }
Add Comment
Please, Sign In to add comment