In your ActionForm, add the validation to the validate method.

For example, you would have something like this:

public ActionErrors validate(ActionMapping mapping,
                 HttpServletRequest request) {

    ActionErrors errors = new ActionErrors();

    if ((person == null) || (person.length() < 1))
      errors.add("person", new ActionError("ch03.hello.no.person.error"));

    return errors;
  }


where 'person' is the name of the select box field.


On Sat, 18 Sep 2004 21:41:49 +0530, Priya Jotwani
<[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I have a page where a user should select something from the dropdown
> before clicking on Submit. If he doesn't selects anything, an
> errorMessage should get displayed on the same page saying  ' Please
> select an option '
> 
> How can I do such validations in Struts.
> 
> Thanks in Advance,
> 
> Priya
> 
> 



-- 
...
Rogue Chameleon
...

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to