You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Thaminda Karunanayake <th...@gmail.com> on 2008/02/27 12:18:05 UTC

Struts 2 Custom Validation

Hi all,



Can someone tell me how to achieve client side validation in struts 2 with
custom validators....

It seems that password conformation in client side is not possible with the
provided validators in struts 2.
If we are to write a new validator in struts 2, what are the steps that we
have to follow?




Thanks...
Thaminda

Re: Struts 2 Custom Validation

Posted by Randy Burgess <RB...@nuvox.com>.
This is server side though so it may not be what you need. You will need
your own javascript for the client as it is not generated for this
validator.

Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications



> From: Randy Burgess <RB...@nuvox.com>
> Reply-To: Struts Users Mailing List <us...@struts.apache.org>
> Date: Wed, 27 Feb 2008 09:48:57 -0500
> To: Struts Users Mailing List <us...@struts.apache.org>
> Subject: Re: Struts 2 Custom Validation
> 
> You mean a form with a password field and a confirm password field and
> validation that they match?
> 
> @FieldExpressionValidator(expression = "confirmPwd.equals(pwd)", message =
> "Passwords do not match.")
> 
> In this case I have 2 fields, one named pwd and one named confirmPwd. I put
> this validation on the setter for confirmPwd along with a
> @RequiredStringValidator for both.
> 
> Regards,
> Randy Burgess
> Sr. Web Applications Developer
> Nuvox Communications
> 
> 
> 
>> From: Thaminda Karunanayake <th...@gmail.com>
>> Reply-To: Struts Users Mailing List <us...@struts.apache.org>
>> Date: Wed, 27 Feb 2008 16:48:05 +0530
>> To: <us...@struts.apache.org>
>> Subject: Struts 2 Custom Validation
>> 
>> Hi all,
>> 
>> 
>> 
>> Can someone tell me how to achieve client side validation in struts 2 with
>> custom validators....
>> 
>> It seems that password conformation in client side is not possible with the
>> provided validators in struts 2.
>> If we are to write a new validator in struts 2, what are the steps that we
>> have to follow?
>> 
>> 
>> 
>> 
>> Thanks...
>> Thaminda
> 
> 
> 
> This email and any attachments ("Message") may contain legally privileged
> and/or confidential information.  If you are not the addressee, or if this
> Message has been addressed to you in error, you are not authorized to read,
> copy, or distribute it, and we ask that you please delete it (including all
> copies) and notify the sender by return email.  Delivery of this Message to
> any person other than the intended recipient(s) shall not be deemed a waiver
> of confidentiality and/or a privilege.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 



This email and any attachments ("Message") may contain legally privileged and/or confidential information.  If you are not the addressee, or if this Message has been addressed to you in error, you are not authorized to read, copy, or distribute it, and we ask that you please delete it (including all copies) and notify the sender by return email.  Delivery of this Message to any person other than the intended recipient(s) shall not be deemed a waiver of confidentiality and/or a privilege.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Struts 2 Custom Validation

Posted by Randy Burgess <RB...@nuvox.com>.
You mean a form with a password field and a confirm password field and
validation that they match?

@FieldExpressionValidator(expression = "confirmPwd.equals(pwd)", message =
"Passwords do not match.")

In this case I have 2 fields, one named pwd and one named confirmPwd. I put
this validation on the setter for confirmPwd along with a
@RequiredStringValidator for both.

Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications



> From: Thaminda Karunanayake <th...@gmail.com>
> Reply-To: Struts Users Mailing List <us...@struts.apache.org>
> Date: Wed, 27 Feb 2008 16:48:05 +0530
> To: <us...@struts.apache.org>
> Subject: Struts 2 Custom Validation
> 
> Hi all,
> 
> 
> 
> Can someone tell me how to achieve client side validation in struts 2 with
> custom validators....
> 
> It seems that password conformation in client side is not possible with the
> provided validators in struts 2.
> If we are to write a new validator in struts 2, what are the steps that we
> have to follow?
> 
> 
> 
> 
> Thanks...
> Thaminda



This email and any attachments ("Message") may contain legally privileged and/or confidential information.  If you are not the addressee, or if this Message has been addressed to you in error, you are not authorized to read, copy, or distribute it, and we ask that you please delete it (including all copies) and notify the sender by return email.  Delivery of this Message to any person other than the intended recipient(s) shall not be deemed a waiver of confidentiality and/or a privilege.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org