You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dan Allen <da...@mojavelinux.com> on 2003/04/07 02:46:34 UTC
missing message key
Is there anyway to suppress the missing message key error and just
have it enter either an empty string or a string with ??? in it?
For instance, say I have
<bean:message key="not.a.key"/>
Instead of throwing a Jaspar error, it would either return empty
string or it would place into the page
???not.a.key???
I know I read something about editing web.xml to have it return null
for missing keys, but that doesn't seem to work.
The code in MessageTag.java is as follows
// Retrieve the message string we are looking for
String message = RequestUtils.message(pageContext, this.bundle,
this.localeKey, key, args);
if (message == null) {
JspException e = new JspException
(messages.getMessage("message.message", key));
RequestUtils.saveException(pageContext, e);
throw e;
}
There doesn't seem to be any option there for preventing the exception from
being thrown.
Dan
--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Daniel Allen, <da...@mojavelinux.com>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Real programmers just hate to get up in the morning, and
contrary to Ordinary People, they're in better shape as
it gets closer to nighttime.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: missing message key
Posted by Dan Allen <da...@mojavelinux.com>.
Dan Allen (dan@mojavelinux.com) wrote:
> Is there anyway to suppress the missing message key error and just
> have it enter either an empty string or a string with ??? in it?
> For instance, say I have
>
> <bean:message key="not.a.key"/>
>
> Instead of throwing a Jaspar error, it would either return empty
> string or it would place into the page
>
> ???not.a.key???
>
> I know I read something about editing web.xml to have it return null
> for missing keys, but that doesn't seem to work.
>
> The code in MessageTag.java is as follows
>
> // Retrieve the message string we are looking for
> String message = RequestUtils.message(pageContext, this.bundle,
> this.localeKey, key, args);
> if (message == null) {
> JspException e = new JspException
> (messages.getMessage("message.message", key));
> RequestUtils.saveException(pageContext, e);
> throw e;
> }
>
> There doesn't seem to be any option there for preventing the exception from
> being thrown.
Answered my own question again:
controller setting
null="false"
Dan
--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Daniel Allen, <da...@mojavelinux.com>
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Since no one can ever know for certain whether or not his own
view of creation is the correct one, it is impossible for him
to know if someone else's is the wrong one.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org