Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » Struts 2 »

@CustomValidator annotation

Alex Wibowo

2007-03-04


Hi all,

I was trying to find some examples on @CustomValidator annotation on the
struts page. But I couldnt find any. Before we get to that, let me explain
the situation I am having.
I have a struts action class with a POJO bean in it. I wanted to validate
this bean. The problem is that
the validation I need is not simple.
The POJO has a java.util.List of another POJO type... roughly in the form
of:

class AClass{
String prop1;
int prop2;
....
..
}


I need to check for each of this item:
- if prop2 is populated, then prop1 has to be populated as well.
- prop2 has to be an integer.

is @CustomValidator the right path I should look at?


Thanks in advance!




--
Best regards,


Alex
-------------------
©2008 junlu.com - Jax Systems, LLC, U.S.A.