You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Pierre Thibaudeau (JIRA)" <ji...@apache.org> on 2008/07/23 18:08:06 UTC

[jira] Created: (WW-2732) OGNL-evaluates "key" when it is not found in resource bundle

<s:text name="key"/> OGNL-evaluates "key" when it is not found in resource bundle
---------------------------------------------------------------------------------

                 Key: WW-2732
                 URL: https://issues.apache.org/struts/browse/WW-2732
             Project: Struts 2
          Issue Type: Bug
          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


<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.


[jira] Commented: (WW-2732) OGNL-evaluates "key" when it is not found in resource bundle

Posted by "Pierre Thibaudeau (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45304#action_45304 ] 

Pierre Thibaudeau commented on WW-2732:
---------------------------------------

Thanks Musachy!  I look forward to trying this new tag out!

> <s:text name="key"/> OGNL-evaluates "key" when it is not found in resource bundle
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2732
>                 URL: https://issues.apache.org/struts/browse/WW-2732
>             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: 2.1.3
>
>
> <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.


[jira] Commented: (WW-2732) OGNL-evaluates "key" when it is not found in resource bundle

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45301#action_45301 ] 

Musachy Barroso commented on WW-2732:
-------------------------------------

In fact, after changing the documentation I started to add a param to the tag. It will be in trunk soon, that's why I didnt close the ticket with my last comment.

> <s:text name="key"/> OGNL-evaluates "key" when it is not found in resource bundle
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2732
>                 URL: https://issues.apache.org/struts/browse/WW-2732
>             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.


[jira] Resolved: (WW-2732) OGNL-evaluates "key" when it is not found in resource bundle

Posted by "James Holmes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Holmes resolved WW-2732.
------------------------------

    Resolution: Not A Problem

Please use the <s:property/> tag as specified in the comments here.

> <s:text name="key"/> OGNL-evaluates "key" when it is not found in resource bundle
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2732
>                 URL: https://issues.apache.org/struts/browse/WW-2732
>             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.


[jira] Resolved: (WW-2732) OGNL-evaluates "key" when it is not found in resource bundle

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Musachy Barroso resolved WW-2732.
---------------------------------

       Resolution: Fixed
    Fix Version/s:     (was: Future)
                   2.1.3

I added a "searchValueStack" attribute to the "text" tag, which will be set to "true" by default for backward compatibility. Setting that attribute to false, will output the key, if the key is not found in the resource files.

> <s:text name="key"/> OGNL-evaluates "key" when it is not found in resource bundle
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2732
>                 URL: https://issues.apache.org/struts/browse/WW-2732
>             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: 2.1.3
>
>
> <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.


[jira] Commented: (WW-2732) OGNL-evaluates "key" when it is not found in resource bundle

Posted by "Pierre Thibaudeau (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45303#action_45303 ] 

Pierre Thibaudeau commented on WW-2732:
---------------------------------------

Not quite, Kevin

If I use <s:text name="title"/>, it's because I should have a resource whose keyname is "title" and whose value is something like "The Grant Title of This Magnum Opus".  Now, we all know that it's easy to overlook resources (especially in development).

In Struts1, in the case of such omission, an error message is displayed in the output of the JSP.  That's a very reasonable option.  Though rather annoying, as it prevents from checking other details on the page.

In Struts2, the documentation states that:

>> If the named message is not found, then the body of the tag will be used as default message. If no body is used, then the name of the message will be used.<<

That seems to me like an even better proposition than with Struts1 (the "reasonable default" aimed at by S2)!  In my case, seeing "title" output is almost as good as seeing what I had intended, namely "The Grand Title of This Magnum Opus".  Certainly it allows me to examine how the page looks like, despite my having forgotten one resource.

In practice, while developping, I omit not one but 100 resources.  But with S2 trying to evaluate lots and lots and lots of expression which were *clearly* never intended to be evaluated, my development logs are becoming increasingly impossible to read (because of all the OGNL-evaluation errors), lest I switch most logging off (which is equally useless).

Now it seems reasonable to me that the "test" parameter of the <s:if/> tag should be evaluated by default.  (Even though it wouldn't bother me to have to write %{1 == 1} each time.)  But it seems to me to run against the natural S2-grain (of "reasonable default") to assume that the keyname of a resource is an expression in need of evaluation.  I think instead that, for the very unusual cases when we DO need to evaluate an expression denoting the keyname of a resource, we should then rely on the explicit %{expression}-notation.

That is to say, for example, if "title" is the name of a property on the action with value "The Great Gatsby" and if I forgot to include a "title" resource, then the following two expressions should respectively yield:

<s:text name="title"/>  ==>  title
<s:text name="%{title}"/> ==> The Great Gatsby

If that's unreasonable, why not simply going back to S1's convention of throwing an error message?

> <s:text name="key"/> OGNL-evaluates "key" when it is not found in resource bundle
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2732
>                 URL: https://issues.apache.org/struts/browse/WW-2732
>             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: 2.1.3
>
>
> <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.


[jira] Commented: (WW-2732) OGNL-evaluates "key" when it is not found in resource bundle

Posted by "Pierre Thibaudeau (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45299#action_45299 ] 

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: https://issues.apache.org/struts/browse/WW-2732
>             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.


[jira] Commented: (WW-2732) OGNL-evaluates "key" when it is not found in resource bundle

Posted by "Kevin Biesbrock (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45300#action_45300 ] 

Kevin Biesbrock commented on WW-2732:
-------------------------------------

It sounds to me like you're looking for a solution to provide 'Title = "The Great Gatsby" '.  Is this correct?
What benefit is there to using <s:text... /> when you could use <span>Title:</span> <s:property name="title" /> or something similar?

> <s:text name="key"/> OGNL-evaluates "key" when it is not found in resource bundle
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2732
>                 URL: https://issues.apache.org/struts/browse/WW-2732
>             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.


[jira] Commented: (WW-2732) OGNL-evaluates "key" when it is not found in resource bundle

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45298#action_45298 ] 

Musachy Barroso commented on WW-2732:
-------------------------------------

I tested this and my suggestion does not work, it still does the same thing. I am not sure what to do here, as it is working as intended, maybe just document it?

> <s:text name="key"/> OGNL-evaluates "key" when it is not found in resource bundle
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2732
>                 URL: https://issues.apache.org/struts/browse/WW-2732
>             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.


[jira] Commented: (WW-2732) OGNL-evaluates "key" when it is not found in resource bundle

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45278#action_45278 ] 

Musachy Barroso commented on WW-2732:
-------------------------------------

Yes, you are right. Looking at the code(TextProviderHelper.getText), it seems like this was the original intention. What happens if you use:

<s:text name="%{'tile'}" />

? I think that would have the effect that you expect, but I haven't tested it.

> <s:text name="key"/> OGNL-evaluates "key" when it is not found in resource bundle
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2732
>                 URL: https://issues.apache.org/struts/browse/WW-2732
>             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.


[jira] Reopened: (WW-2732) OGNL-evaluates "key" when it is not found in resource bundle

Posted by "James Holmes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Holmes reopened WW-2732:
------------------------------


Re-opening per original reporter.

> <s:text name="key"/> OGNL-evaluates "key" when it is not found in resource bundle
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2732
>                 URL: https://issues.apache.org/struts/browse/WW-2732
>             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.


[jira] Commented: (WW-2732) OGNL-evaluates "key" when it is not found in resource bundle

Posted by "Kevin Biesbrock (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45305#action_45305 ] 

Kevin Biesbrock commented on WW-2732:
-------------------------------------

And searching the resources file could return something other than title (e.g., in the case of I18N)?  Is that what I'm missing?

> <s:text name="key"/> OGNL-evaluates "key" when it is not found in resource bundle
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2732
>                 URL: https://issues.apache.org/struts/browse/WW-2732
>             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: 2.1.3
>
>
> <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.


[jira] Commented: (WW-2732) OGNL-evaluates "key" when it is not found in resource bundle

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45270#action_45270 ] 

Musachy Barroso commented on WW-2732:
-------------------------------------

If you want to output a property value, then use the "property" tag. the "text" tag is supposed to work with resources. I think this one can be closed.

> <s:text name="key"/> OGNL-evaluates "key" when it is not found in resource bundle
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2732
>                 URL: https://issues.apache.org/struts/browse/WW-2732
>             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.


[jira] Issue Comment Edited: (WW-2732) OGNL-evaluates "key" when it is not found in resource bundle

Posted by "Pierre Thibaudeau (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45275#action_45275 ] 

pierdeux edited comment on WW-2732 at 12/16/08 8:00 AM:
-----------------------------------------------------------------

Apologies if I am being stupid here, but I think I don't grasp Musachy's comment.  In my earlier example, I specifically did NOT want to output a property value when using the <s:text> tag.  Therefore I specifically (under no circumstance) want <s:text name="title"/> to mean the same thing as <s:property value="title"/>.  (I am not mistaking one tag for the other, whereas the actual implementation seems to...)

(In my "Great Gatsby" example above, please don't get sidetracked by the "${title}":  that was not part of the issue at all.  You can rewrite my example, swapping ${title} for <s:property value="title"/> without changing the point I intended to make.)

The reason to worry about such details is not purely one of clarifying muddied categories.  It's also one of efficiency.  OGNL is noticeably slow, and I am certain that calling for OGNL-evaluation when it's unwanted is most undesirable...

      was (Author: pierdeux):
    Apologies if I am being stupid here, but I don't understand the relevance of Musachy's comment.  In my earlier example, I specifically did NOT want to output a property value when using the <s:text> tag.  Therefore I specifically (under no circumstance) want <s:text name="title"/> to mean the same thing as <s:property value="title"/>.  (I am not mistaking one tag for the other, whereas the actual implementation seems to...)

(In my "Great Gatsby" example above, please don't get sidetracked by the "${title}":  that was not part of the issue at all.  You can rewrite my example, swapping ${title} for <s:property value="title"/> without changing the point I intended to make.)

The reason to worry about such details is not purely one of clarifying muddied categories.  It's also one of efficiency.  OGNL is noticeably slow, and I am certain that calling for OGNL-evaluation when it's unwanted is most undesirable...
  
> <s:text name="key"/> OGNL-evaluates "key" when it is not found in resource bundle
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2732
>                 URL: https://issues.apache.org/struts/browse/WW-2732
>             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.


[jira] Updated: (WW-2732) OGNL-evaluates "key" when it is not found in resource bundle

Posted by "James Holmes (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Holmes updated WW-2732:
-----------------------------

    Fix Version/s: Future
       Issue Type: Improvement  (was: Bug)

The code is currently working as designed so I'm going to mark this as an improvement.

> <s:text name="key"/> OGNL-evaluates "key" when it is not found in resource bundle
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2732
>                 URL: https://issues.apache.org/struts/browse/WW-2732
>             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.


[jira] Commented: (WW-2732) OGNL-evaluates "key" when it is not found in resource bundle

Posted by "Pierre Thibaudeau (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/struts/browse/WW-2732?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=45275#action_45275 ] 

Pierre Thibaudeau commented on WW-2732:
---------------------------------------

Apologies if I am being stupid here, but I don't understand the relevance of Musachy's comment.  In my earlier example, I specifically did NOT want to output a property value when using the <s:text> tag.  Therefore I specifically (under no circumstance) want <s:text name="title"/> to mean the same thing as <s:property value="title"/>.  (I am not mistaking one tag for the other, whereas the actual implementation seems to...)

(In my "Great Gatsby" example above, please don't get sidetracked by the "${title}":  that was not part of the issue at all.  You can rewrite my example, swapping ${title} for <s:property value="title"/> without changing the point I intended to make.)

The reason to worry about such details is not purely one of clarifying muddied categories.  It's also one of efficiency.  OGNL is noticeably slow, and I am certain that calling for OGNL-evaluation when it's unwanted is most undesirable...

> <s:text name="key"/> OGNL-evaluates "key" when it is not found in resource bundle
> ---------------------------------------------------------------------------------
>
>                 Key: WW-2732
>                 URL: https://issues.apache.org/struts/browse/WW-2732
>             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.