You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Roberto Lima Jr <ro...@softsite.com.br> on 2006/03/26 22:36:34 UTC
Check if a message exists
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!
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Check if a message exists
Posted by Laurie Harper <la...@holoweb.net>.
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