JSF 2.0: Validate equality of 2 InputSecret Fields (confirm password) without writing Code?
Posted
by yournamehere
on Stack Overflow
See other posts from Stack Overflow
or by yournamehere
Published on 2010-05-25T22:36:08Z
Indexed on
2010/05/25
22:41 UTC
Read the original article
Hit count: 513
I'm developing a pure JavaEE6 application with JSF 2.0 and Glassfish. My JSF implementation is Primefaces (beside Mojarra provided by Glassfish).
I want to verify if the values of 2 password fields in a JSF form are equal.
With Seam, there is the neat component <s:validateEquality for="pw1"/>
.
I want do to the same without Seam, just using JSF (or maybe a component of a JSF library). Until now i only saw examples which validate the form with a custom validator. But i would like to compare the fields without writing Java code or Javascript code.
Is that possible?
This what it looks like with Seam:
...
<h:inputSecret id="passwort" value="#{personHome.instance.password}"
redisplay="true" required="true">
<f:validateLength minimum="8"/>
<a:support event="onblur" reRender="passwortField" bypassUpdates="true" ajaxSingle="true" />
</h:inputSecret>
...
<h:inputSecret id="passwort2" required="true" redisplay="true">
<!-- find the JSF2.0-equivalent to this tag: -->
<s:validateEquality for="passwort"/>
<a:support event="onblur" reRender="passwort2Field" bypassUpdates="true" ajaxSingle="true" />
</h:inputSecret>
...
Any help is appreciated. Thanks!
© Stack Overflow or respective owner