Java Mailing List Archive

http://www.junlu.com/

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

Defining a validate() method

Session Mwamufiya

2007-08-06

Replies:

Hi,

I want to set up my own validate method to validate fields in my own way, but I'm not sure how to set up the method. I don't know how to set or clear the validation error message. Is it ok just to use the action's error stack, like this:

public void validate() {
if (listOfExistingElement.contains(field1)) {
  addActionError("This element already exists");
}
}

Is there a better way to make use of the framework, or is this it? I searched for examples online but couldn't find any.

Thanks for the push,
Session


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

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