On Fri, 8 Mar 2002, Joachim Gjesdal wrote:

> Date: Fri, 08 Mar 2002 13:24:21 +0100
> From: Joachim Gjesdal <[EMAIL PROTECTED]>
> Reply-To: Struts Developers List <[EMAIL PROTECTED]>
> To: struts dev <[EMAIL PROTECTED]>
> Subject: [PATCH]  MessageTag that returns the key instead of an exception
>     when key not found.
>
> Since others also have requested this, I'll propose this tiny change.

A better way to handle this (without breaking backwards compatibility with
the current functionality) is to set the "null" initialization parameter
on the controller servlet to "false".  This tells the message resources
module to return a message string like "??? foo ???" for an unknown
message key "foo".  This will cause the <bean:message> tag to always get a
non-null value back, and thus never throw this exception.

>
> joachim gjesdal
>

Craig


> Index:
> jakarta-struts/src/share/org/apache/struts/taglib/bean/MessageTag.java
> ===================================================================
> RCS file:
> 
>/home/cvspublic/jakarta-struts/src/share/org/apache/struts/taglib/bean/MessageTag.java,v
> retrieving revision 1.6
> diff -u -r1.6 MessageTag.java
> ---
> jakarta-struts/src/share/org/apache/struts/taglib/bean/MessageTag.java
>  13 Jan 2002 00:25:36 -0000    1.6
> +++
> jakarta-struts/src/share/org/apache/struts/taglib/bean/MessageTag.java
>  8 Mar 2002 12:14:36 -0000
> @@ -295,10 +295,7 @@
>      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;
> +            message = key;
>          }
>
>      // Print the retrieved message to our output writer
>
>
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to