You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mano Dasanayaka <ma...@mubasher.net> on 2008/02/27 04:59:31 UTC

Need Help Creating a Custom Validator

Hi all,

Can any one suggest me a good article that describes adding a custom
validator and how to configure.  Sample code along with required
configurations is also appreciated.

Thanks In Advance.

Mano



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


RE: Need Help Creating a Custom Validator

Posted by Dave Newton <ne...@yahoo.com>.
--- "Allen, Daniel" <Da...@kbcfp.com> wrote:
> Basically, all you need to do for custom or complex validation is to
> have the action in question implement Validateable, and then have a
> public void validate() method that makes calls to
> addActionError(String). Also check out the built-in validators that you
> can apply with annotations. They're a real time-saver for simple
> validations.
> 
> Is this what you were talking about?

I think the question was regarding custom validators.

> From: Mano Dasanayaka [mailto:mano@mubasher.net] 
> Can any one suggest me a good article that describes adding a custom
> validator and how to configure.  Sample code along with required
> configurations is also appreciated.

I'd recommend looking at [1] and any of the included validators--whichever
one comes the closest to whatever it is you're trying to validate. [2] is a
WebWork article that goes into a bit of detail, but I think looking at one of
the validators included in the distro would be helpful.

Dave

[1] http://struts.apache.org/2.x/docs/validation.html
[2]
http://today.java.net/pub/a/today/2006/01/19/webwork-validation.html?page=3#custom-validators



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


RE: Need Help Creating a Custom Validator

Posted by "Allen, Daniel" <Da...@kbcfp.com>.
Try this:
http://opensource.atlassian.com/confluence/oss/download/attachments/4942
/validating-input.pdf?version=3

Basically, all you need to do for custom or complex validation is to
have the action in question implement Validateable, and then have a
public void validate() method that makes calls to
addActionError(String). Also check out the built-in validators that you
can apply with annotations. They're a real time-saver for simple
validations.

Is this what you were talking about?
~Dan

-----Original Message-----
From: Mano Dasanayaka [mailto:mano@mubasher.net] 
Sent: Tuesday, February 26, 2008 11:00 PM
To: 'Struts Users Mailing List'
Cc: thaminda@mubasher.net; 'Mano Dasanayaka'
Subject: Need Help Creating a Custom Validator

Hi all,

Can any one suggest me a good article that describes adding a custom
validator and how to configure.  Sample code along with required
configurations is also appreciated.

Thanks In Advance.

Mano

-- 
This message may contain confidential, proprietary, or legally privileged information. No confidentiality or privilege is waived by any transmission to an unintended recipient. If you are not an intended recipient, please notify the sender and delete this message immediately. Any views expressed in this message are those of the sender, not those of any entity within the KBC Financial Products group of companies (together referred to as "KBC FP"). 

This message does not create any obligation, contractual or otherwise, on the part of KBC FP. It is not an offer (or solicitation of an offer) of, or a recommendation to buy or sell, any financial product. Any prices or other values included in this message are indicative only, and do not necessarily represent current market prices, prices at which KBC FP would enter into a transaction, or prices at which similar transactions may be carried on KBC FP's own books. The information contained in this message is provided "as is", without representations or warranties, express or implied, of any kind. Past performance is not indicative of future returns.


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