struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pierre Thibaudeau (JIRA)" <>
Subject [jira] Commented: (WW-2732) <s:text name="key"/> OGNL-evaluates "key" when it is not found in resource bundle
Date Wed, 17 Dec 2008 22:09:36 GMT


Pierre Thibaudeau commented on WW-2732:

Thanks Musachy, for your efforts.

Clearly documenting the behaviour would be very very very useful.  (In an ideal world, documenting
both "what's intended" and "what's the actual state of things" would be the goal.)

On the other hand, what about adding one parameter to the tag:  evaluateName="false" (default
could be "true")
to prevent the OGNL evaluation of the "name" parameter?  Something akin to includeParams="none"
of the <s:url/> tag.

(For the sake of the overall picture, it would be worth considering whether such a parameter
could also find its place in other tags---though I don't see where at first sight....)

> <s:text name="key"/> OGNL-evaluates "key" when it is not found in resource bundle
> ---------------------------------------------------------------------------------
>                 Key: WW-2732
>                 URL:
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Plugin - Tags, Value Stack
>    Affects Versions: 2.1.2
>         Environment: Tested with 2.1.2, but the issue could have existed earlier.
>            Reporter: Pierre Thibaudeau
>            Priority: Minor
>             Fix For: Future
> <s:text name="key"/> outputs the resource message designated by "key".
> If no such message exists (and the body of the tag is empty), it reverts to outputting
the name of the key itself, as an unevaluated string.  At least, that's the behaviour of the
tag, as described in the documentation.
> In fact, however, the name of the key is now being evaluated as an OGNL expression, and
if that turns out to be valid, that is what's printed.
> This, in my view, is counter-intuitive and probably counter-productive.  Consider the
case of a ModelDriven<Book> action exposing a Book-object to the View.
> Normally,
>      <s:text name="title"/>: ${title}
> would have yielded:
>     title: The Great Gatsby
> if the resource message "title" was missing from the resource bundle.  That's not too
bad an outcome.  However, with the key being OGNL-evaluated, we would get the following output:
>     The Great Gatsby: The Great Gatsby
> which I find a little puzzling...

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message