0

Im trying to create a Registartion form but i need the user to select and put their password in, then confirm their password.

How would i implement a check to see if these match and if they do stroe them in a RegsisteredBean.java file in a variable.

Im a complete beginner with JSF and XHTML.

Thanks

user3506349
  • 9
  • 1
  • 7
  • interesting: http://stackoverflow.com/questions/2909021/jsf-2-0-validate-equality-of-2-inputsecret-fields-confirm-password-without-wr & http://stackoverflow.com/questions/7489893/how-validate-two-password-fields-by-ajax – Omar Apr 09 '14 at 13:27
  • I had seen these and others but did not undertand them – user3506349 Apr 09 '14 at 16:52
  • You could just take on Primefaces and use the password component http://www.primefaces.org/showcase/ui/password.jsf – kolossus Apr 09 '14 at 20:24

1 Answers1

1

A simple and quick solution is actually done using the primefaces component as below (using the match attribute):

<h:outputLabel for="pwd1" value="Password 1: *" />  
<p:password id="pwd1" value="#{passwordBean.password5}" match="pwd2" label="Password 1" required="true"/>  

<h:outputLabel for="pwd2" value="Password 2: *" />  
<p:password id="pwd2" value="#{passwordBean.password5}" label="Password 2" required="true"/>  

Here's a link to the official showcase examples.

aledpardo
  • 761
  • 9
  • 19