struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laurie Harper <lau...@holoweb.net>
Subject Re: Check if a message exists
Date Wed, 29 Mar 2006 21:49:38 GMT
Roberto Lima Jr wrote:
> Hi, evereyone,
> 
> I need to check if a message was specified in my application.properties 
> before create an ActionError whith this error.
> 
> Example:
> 
> if (hasMessage("error.text.required")) {
>   message = new ActionMessage("error.text.required");
> }else {
>   message = new ActionMessage("error.default.message");
> }
> 
> Does anybody know how to implement the "hasMessage" method???
> 
> Thanks!

How about something like

   MessageResources msgs = getResources();
   if (msgs.getMessage(getLocale(), "error.text.required") {
     message = new ActionMessage("error.text.required");
   } else {
     message = new ActionMessage("error.default.message");
   }

L.


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


Mime
View raw message