The constructor for ActionError takes the key for the error message, not 
the error message itself. This key is then used to look up the (possibly 
localized) message in a message resource.

If the key is not found, by default null will be returned, and nothing will 
be displayed. This is most likely why you are not seeing anything. However, 
you can set a servlet init param to change this behaviour. Adding this to 
your web.xml:

     <init-param>
       <param-name>null</param-name>
       <param-value>false</param-value>
     </init-param>

will cause the string "???key???" (where key is the key name you supplied) 
to be returned, and subsequently displayed, when the requested resource is 
not found.

Hope this helps.

--
Martin Cooper


At 03:17 PM 3/20/01, Marc Ellison wrote:
>Hi,
>
>Am trying out the errors tag but to no avail...I have the following code in
>my validate() method of my relevant Form class...
>
>public ActionErrors validate(ActionMapping mapping, HttpServletRequest
>request) {
>         ActionErrors errors = new ActionErrors();
>         //if (phn == null)
>         errors.add("phn",         new ActionError("phn can't be null"));
>}
>
>...and then have the <html:errors/> tag in my jsp. However when I process
>the request having left the "phn" field empty, nothing pops up on my jsp
>page. Am i missing something vital here. I have followed the docs and API to
>no avail!
>
>Thanks
>
>Marc
>


Reply via email to