I would be leery of changing <bean:message> to support a body. In a fully
localizable page, this is one of the most frequently used tags (if not _the_
most frequently used). Changing a tag from extending TagSupport to extending
BodyTagSupport increases the amount of code that is generated from the JSP
page, especially when the tag is frequently used. There is a risk, then,
that existing pages will break because they generate more code than they
used to.

--
Martin Cooper


----- Original Message -----
From: "Craig R. McClanahan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 21, 2001 9:07 AM
Subject: Re: Proposed enhancement to <bean:message>


>
>
> On Thu, 21 Jun 2001, Ted Husted wrote:
>
> > I'm probably +1 on this. I'm just not sure when you would want to
> > specify the key dynamically. I'd also wonder if there's a need to
> > specify the key dynamically, do we need to offer the same for the bundle
> > too?
> >
>
> I think the general concept of variable arguments, expressed as nested
> tags, for <bean:message> (and other related tags) makes sense.
>
> Craig
>
>
> > <OT>
> >
> > Meanwhile, I also wonder if we should have "textKey" and "bundle"
> > attributes for the html:link and html:submit tags, so you could use the
> > < ... /> form instead something like <html:link ...><bean:message ...
> > /></html:link>. This would be consistent with how <html:image> and
> > <html:img> work.
> >
> > Also, I should play with this myself first, but since we're talking
> > i18n, if I have internationalized a button, and have multiple buttons,
> > then HTTP is going to submit the i18n label as a value. How do I parse
> > that in the Action, can I do a reverse lookup in the resource based on
> > the actor's locale? Or am I overlooking something?
> >
> > </OT>
> >
> > -- Ted Husted, Husted dot Com, Fairport NY USA.
> > -- Custom Software ~ Technical Services.
> > -- Tel 716 737-3463.
> > -- http://www.husted.com/about/struts/
> >
> > Martin Cooper wrote:
> > >
> > > I posted this a few weeks ago as a patch, when it should more properly
have
> > > been a proposal. Here, then, is the proposal:
> > >
> > > A problem with the current <bean:message> tag is that the only way to
> > > specify the message resource key dynamically is by using a JSP
expression.
> > > This leads to the use of the following pattern:
> > >
> > >     <bean:define id="myKey" name="myForm" property="myKeyProperty"
> > > type="java.lang.String"/>
> > >     <bean:message key="<%= myKey %>"/>
> > >
> > > An alternative is to have the Action look up the key and set the
resulting
> > > string value in the property for use on the JSP page via <bean:write>.
This
> > > doesn't feel right, because the responsibility for looking up the
> > > appropriately localized text is then divided between the Action and
the JSP
> > > page.
> > >
> > > By enhancing the <bean:message> tag to allow it to obtain the message
> > > resource key from a bean property, we can simplify the above example
to:
> > >
> > >     <bean:message name="myForm" property="myKeyProperty"/>
> > >
> > > Here, the 'name' and 'property' attributes are used to obtain the
message
> > > resource key from a bean. That key is then used as if it had been
specified
> > > using the 'key' attribute.
> > >
> > > I believe this proposal would enhance the i18n functionality of Struts
by
> > > allowing dynamic specification of messages, while delegating the
resolution
> > > of the actual message text to the view.
> > >
> > > Comments?
> > >
> > > --
> > > Martin Cooper
> >
>


Reply via email to