This is some code that I used in an actionForm.
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if ((userId == null) || (userId.length() < 1)) {
errors.add("noUser", new ActionError
("adresses.insertUser.noUser"));
}

return errors;
}

In the applicationResources.properties, you have to add the message : 
adresses.insertUser.noUser=You have to give a userId

This should work.

Why don't you try the validator framework. You don't have to create an ActionForm for 
each jsp you create.

Koen Boutsen

--------- Original Message ---------

DATE: Mon, 15 Sep 2003 10:22:27
From: Ritvik <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: 

>Hi There,
>
>I am using <html:errors\> tag at top of my page to display any
>validation errors when a form is submitted, but for some reason, I
>couldn't see any errors message even I have left some mandatory fields
>blank. I am not getting any errors in server log as well.
>
>I have added the validation logic in validate() method of ActionForm
>subclass. I think Struts adds ActionErrors object in the request\session
>scope with a know key, can anyone let me know the exaclt key name?
>
>What would be the best way test errors using Struts?
>
>thanks,
>Ritvik
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>



____________________________________________________________
Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!
http://login.mail.lycos.com/r/referral?aid=27005

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

Reply via email to