You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Zakaria KHABOT <z....@ced.finances.gov.ma> on 2005/05/13 19:26:37 UTC

saveErrors

hi all,
in my action I put :
errors.add("erreur",new ActionError("Le CINn Agent doit etre numérique: 
Mise à jour non réalisée"));
saveErrors(request,errors);
But the errors are not displayed in the JSP althought :
log.info("la taille des erreurs est " + errors.size()); displays 2 erroes
Thanks for all

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: saveErrors

Posted by Davide Cavallari <d....@ilte.com>.
Zakaria KHABOT wrote:
> in my action I put :
> errors.add("erreur",new ActionError("Le CINn Agent doit etre numérique: Mise à jour non réalisée"));

 From the Javadoc:

public ActionError(java.lang.String key)

     Deprecated.

     Construct an action error with no replacement values.

     Parameters:
         key - Message key for this error message


So the String you pass to the ActionError constructor must be the key of 
a message defined in the resources file of your application.

It is defined in the struts-config.xml:

     <message-resources parameter="resources.application"/>

This specify the file WEB-INF/classes/resources/application.properties.

Put a line like the following in it:

err.ex=Le CINn Agent doit etre numérique: Mise à jour non réalisée.

Then use:

errors.add("erreur",new ActionError("err.ex"));

before saveErrors().

Notice that ActionError is now deprecated.
-- 
Davide

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org