[ 
https://issues.apache.org/jira/browse/WW-5368?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17793890#comment-17793890
 ] 

Lukasz Lenart commented on WW-5368:
-----------------------------------

The tag {{<s:select/>}} is on the top of the ValueStack when evaluating 
expressions {{{}%{...{}}}} so that's why you see the warning and access to 
{{getLabel()}} is blocked.

I would suggest adding a method to an action and used it instead of the 
expression, eg.
{code:java}
public String createLabel(String suffix) {
  return getText("label.reasonOfTransaction." + suffix)
}
{code}
and the in the tag
{code:html}
<s:select name="reasonOfTransactionCode" list="reasonOfTransactionList"      
listKey="top" listValue="%{createLabel(top)}"/> 
{code}

> Access warning when get resource bundle which its name starts with "label"
> --------------------------------------------------------------------------
>
>                 Key: WW-5368
>                 URL: https://issues.apache.org/jira/browse/WW-5368
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 6.3.0
>            Reporter: Alireza Fattahi
>            Priority: Critical
>             Fix For: 6.4.0
>
>
> The below:
> {code:java}
> <s:select name="reasonOfTransactionCode" list="reasonOfTransactionList"      
> listKey="top" listValue="%{getText('label.reasonOfTransaction.'+top)}"/> 
> {code}
> generates this warning for each item in the list, so if the 
> `reasonOfTransactionList` has seven items I see this error seven time:
> {code:java}
> ognl.SecurityMemberAccess: Access to non-public [protected java.lang.String 
> org.apache.struts2.components.UIBean.label] is blocked!
>  
> {code}
>  
> But this works fine If I  just rename resource bundle and removes `label` 
> from its name
>  
> {code:java}
> <s:select name="reasonOfTransactionCode" list="reasonOfTransactionList"      
> listKey="top" listValue="%{getText('reasonOfTransaction.'+top)}"/> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to