[
https://issues.apache.org/jira/browse/WW-2387?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dave Newton updated WW-2387:
----------------------------
Description:
The Text tag used for getting messages to the page will only look inside the
first TextProvider found in the stack. In my case I found that there were three
TextProviders in the stack so the page displays the correct message only when
the first TextProvider contains the message I'm looking for.
Code from {{o.a.s2.components.Text.java}} breaks after the 1st {{TextProvider}}
is found:
{code}
for (Iterator i = getStack().getRoot().iterator(); i.hasNext()) {
Object o = i.next();
if (o instanceof TextProvider) {
TextProvider tp = (TextProvider) o;
msg = tp.getText(actualName, defaultMessage, values, stack);
break;
}
}
{code}
The code will work if I insert for example
{code}
// actualName is the default message returned by the TextProvider if nothing is
found.
if (StringUtils.equals(msg, actualName))
continue;
{code}
before the break.
was:
The Text tag used for getting messages to the page will only look inside the
first TextProvider found in the stack. In my case I found that there were three
TextProviders in the stack so the page displays the correct message only when
the first TextProvider contains the message I'm looking for.
Code from org.apache.struts2.components.Text.java (breaks after the 1st
TextProvider):
<code>
for (Iterator iterator = getStack().getRoot().iterator();
iterator.hasNext();) {
Object o = iterator.next();
if (o instanceof TextProvider) {
TextProvider tp = (TextProvider) o;
msg = tp.getText(actualName, defaultMessage, values, stack);
break;
}
}
</code>
The code will work if I insert for example
<code>
if(StringUtils.equals(msg, actualName)) //actualName is the default message
returned by the TextProvider if nothing is found.
continue;
</code>
before the break.
> Text tag doesn't consider having several TextProviders in stack
> ---------------------------------------------------------------
>
> Key: WW-2387
> URL: https://issues.apache.org/jira/browse/WW-2387
> Project: Struts 2
> Issue Type: Bug
> Components: Other
> Affects Versions: 2.1.1
> Reporter: Sauli Ketola
> Fix For: 2.1.1
>
> Attachments: patchfile.txt
>
>
> The Text tag used for getting messages to the page will only look inside the
> first TextProvider found in the stack. In my case I found that there were
> three TextProviders in the stack so the page displays the correct message
> only when the first TextProvider contains the message I'm looking for.
> Code from {{o.a.s2.components.Text.java}} breaks after the 1st
> {{TextProvider}} is found:
> {code}
> for (Iterator i = getStack().getRoot().iterator(); i.hasNext()) {
> Object o = i.next();
> if (o instanceof TextProvider) {
> TextProvider tp = (TextProvider) o;
> msg = tp.getText(actualName, defaultMessage, values, stack);
> break;
> }
> }
> {code}
> The code will work if I insert for example
> {code}
> // actualName is the default message returned by the TextProvider if nothing
> is found.
> if (StringUtils.equals(msg, actualName))
> continue;
> {code}
> before the break.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira