Actually, I think I was misunderstood. I don't want it to print anything for the user. What I was thinking of is something like this:
<bean:message key="someKey" defaultKey="someOtherKey" /> What this means is "if you don't find "someKey" then don't throw an exception, but rather try the default key "someOtherKey", and if *that* doesn't work, then throw an exception. Even better: <bean:message key="someKey" defaultKey="someOtherKey" defaultValue="someValue" /> I would make both defaultKey and defaultValue *optional*. If defaultValue is specified, and if none of the keys is found, then simply the default value is displayed. What do you guys think? -----Original Message----- From: keithBacon [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 05, 2002 4:15 AM To: Struts Users Mailing List Subject: Re: <bean:message> default key? me too! Would anybody prefer returning a message like "struts warning - message:"+ key +" not found); and just printing a warning. This is a bit mucky but at least lets the system carry on running. Not sure myself. K. --- Joachim Gjesdal <[EMAIL PROTECTED]> wrote: > Yeah, and then submit the patch and ask a comitter if this would be > better than throwing an exception. I?m all for it! > > if (message == null) { > /* > JspException e = new JspException > (messages.getMessage("message.message", key)); > RequestUtils.saveException(pageContext, e); > throw e; > */ > ResponseUtils.write(pageContext, key); > } > > joachim gjesdal > > Hani Hamandi wrote: > > >Ok, and then what? Re-jar struts myself with this new source-code? > >Thanks! > > > >-----Original Message----- > >From: Joachim Gjesdal [mailto:[EMAIL PROTECTED]] > >Sent: Monday, March 04, 2002 4:27 PM > >To: Struts Users Mailing List > >Subject: Re: <bean:message> default key? > > > > > >Hani, > >No, its easy :-) , just see the sourcecode for > >org.apache.struts.MessageTAG, remove the JSPException that is thrown and > >return the key. > > > >joachim gjesdal > > > >Hani Hamandi wrote: > > > >>Man! Is this a hard one? :( > >> > >>-----Original Message----- > >>From: Hani Hamandi [mailto:[EMAIL PROTECTED]] > >>Sent: Monday, March 04, 2002 11:49 AM > >>To: Struts Users Mailing List (E-mail) > >>Subject: <bean:message> default key? > >> > >> > >>Folks, > >> > >>Is there any way to tell <bean:message>, "if you can't find this key, then > >>use that key" ? > >> > >>Here's what I would like to do: > >>For every property in my ApplicationResources, I would like to have a > >>default value, and a couple different texts for different contexts (in the > >>same language, English). > >>So I thought of this (so far theoretical) approach: > >>Here's how one property, "X.Y.Z" for example, would look like: > >> > >>X.Y.Z=default text > >>A.X.Y.Z=different text A > >>B.X.Y.Z=different text B > >> > >>What I want to achieve is: > >> > >>Whenever I use <bean:message key = "A.X.Y.Z" />, if this key is not found, > >>then use the key "X.Y.Z" (the default value). And similarly, whenever I use > >><bean:message key = "B.X.Y.Z" />, if this key is not found, then use the > >>"X.Y.Z". > >> > >>Is there any way to do that? > >> > >>Thanks! > >>Hani. > >> > >> > >> > >> > >> > >> > >> > >> > >> > >>-- > >>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]> > > > > > > > > > >-- > >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]> > > > > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > ===== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Search the archive:- http://www.mail-archive.com/struts-user%40jakarta.apache.org/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Keith Bacon - Looking for struts work - South-East UK. phone UK 07960 011275 __________________________________________________ Do You Yahoo!? Try FREE Yahoo! Mail - the world's greatest free email! http://mail.yahoo.com/ -- 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]>

