velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Bubna <nat...@esha.com>
Subject Re: Not able to retrieve errors
Date Wed, 16 Jun 2004 15:34:47 GMT
Prabhakar Krishnaswami said:
> I am having a problem where I am not able to retrieve errors objects
> saved in the request. I have saved the error objects as per the standard
> protocol outlined in many struts textbooks:
>
>               ActionError ae = new
> ActionError("exception.required.field","Title");
>              errArray.add(ActionErrors.GLOBAL_ERROR,ae);
>              this.saveErrors(req,errArray);
>              return map.findForward("copyfillinform");
>
> I try to retrieve the error objects as below:
>
> #if($errors.exist())
>   #foreach ($e in $errors.all )
>             <error>$e</error>
>   #end
> #end
>
> when I print out the XML being generated, I don't see the error tag
> along with the message being generated.  Is there a syntax error in
> retrieving the error object?

it all looks pretty good to me.  are there any errors or warnings in the log
output?  also, what versions of VelocityTools and Struts are you using?  and
here's a few more shot in the dark questions...  are you sure the ErrorsTool
is defined in your toolbox and that your toolbox is getting loaded?  what
happens if you put the following in your template:

#set( $actionerrors =
$request.getAttribute('org.apache.struts.action.ERROR') )
ActionErrors class: $actionerrors.class.name
ActionErrors size: $actionerrors.size()
#foreach( $e in $actionerrors.get() )
ActionError key: $e.key
#end

oh, and lastly, it shouldn't be the problem, but you ought to know that
ActionError and ActionErrors.GLOBAL_ERROR are deprecated.  you should use
ActionMessage and ActionMessages.GLOBAL_MESSAGE instead.

Nathan Bubna
nathan@esha.com


---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message