problem in validator method
Hi to all, i have this jsf code:
<h:outputText value="#{bundle.oldPassword}:" />
<h:inputSecret id="oldPassword" value="#{userManager.oldPassword}" required="true"></h:inputSecret>
<t:message id="oldPasswordError" for="oldPassword" styleClass="error"/>
<h:outputText value="#{bundle.newPassword}:" />
<h:inputSecret id="newPassword" validator="#{userManager.validateChangePassword}" value="#{userManager.newPassword}" required="true"></h:inputSecret>
<t:message id="newPasswordError" for="newPassword" styleClass="error"/>
<h:outputText value="#{bundle.retypePassword}:" />
<h:inputSecret id="retypePassword" value="#{userManager.retypePassword}" required="true"></h:inputSecret>
<t:message id="retypePasswordError" for="retypePassword" styleClass="error"/>
The field "newPassword" has the validator method "validateChangePassword".
The validator method is (is a test):
public void validateChangePassword(FacesContext fc, UIComponent ui, Object o){
UIInput old = (UIInput)fc.getViewRoot().findComponent("oldPassword");
UIInput pass = (UIInput)fc.getViewRoot().findComponent("newPassword");
UIInput retp = (UIInput)fc.getViewRoot().findComponent("retypePassword");
System.out.println(" "+old.getValue());
System.out.println(" "+pass.getValue());
System.out.println(" "+retp.getValue());
FacesMessage facesMessage = new FacesMessage("Error password");
throw new ValidatorException(facesMessage);
}
I must know the values of all three fields in jsf page, but, with the method above, i get only the value of one of the fields, the others return null.
How can i do to getting all three values?
Thanks!

