« Return to Thread: validation with annotation

validation with annotation

by xianwinwin :: Rate this Message:

Reply to Author | View in Thread

Hi there,

I would like to create a validation with annotation.
consider the following case:

@Validation
public class AddCaseAction
{
        private Registration registration;
.
.
.

        public String addNewRegistration()
        {
                //do something
                return "success";
        }

// get and setRegistration here
}

assuming registration is composed of fname, lname, ss, dob and except dob all fields are mandatory.

Question: how do I make sure those fields will be input? should I have something like:

@RequiredStringValidator(message="Legal Name is missing")
private setFname(String fn)

on the registration - if so - wouldn't that effect other classes that uses registration???

thanks for any input!

 « Return to Thread: validation with annotation