You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Lukasz Lenart (JIRA)" <ji...@apache.org> on 2014/09/16 08:32:33 UTC

[jira] [Resolved] (WW-4228) OGNL Basic: if AllowStaticMethodAccess is set to true, JSP fragments included with can access Action members, otherwise they can't.

     [ https://issues.apache.org/jira/browse/WW-4228?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Lukasz Lenart resolved WW-4228.
-------------------------------
    Resolution: Cannot Reproduce
      Assignee: Lukasz Lenart

Feel free to re-open when disagree

> OGNL Basic: if AllowStaticMethodAccess is set to true, JSP fragments included with <jsp:include/> can access Action members, otherwise they can't.
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-4228
>                 URL: https://issues.apache.org/jira/browse/WW-4228
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Documentation
>    Affects Versions: 2.3.15.2
>         Environment: JBOSS EAP 6.01, Struts 2.3.15.2
>            Reporter: Andrea Ligios
>            Assignee: Lukasz Lenart
>            Priority: Trivial
>              Labels: include, jsp, ognl
>             Fix For: 2.3.18
>
>
> Trying to call an Action's getter from an included JSP, I get null:
> {code:title=MyAction.java|borderStyle=solid}
> private String message = "The message I want to read...";
> public String getMessage() { 
>     return message; 
> }
> {code}
> {code:title=main.jsp|borderStyle=solid}
> <%@taglib prefix="s" uri="/struts-tags" %>
> <html>
>    <head></head>
>    <body>
>        <div> I'm a DIV in main.jsp </div>           
>        <jsp:include page="fragment.jsp" />
>    <body>
> </html>
> {code}
> {code:title=fragment.jsp|borderStyle=solid}
> <%@taglib prefix="s" uri="/struts-tags" %>
> <div>
>     I'm a DIV from fragment.jsp
>     <br/>
>     Message from Action: <s:property value="message" />
> </div>
> {code}
> If I set:
> {code:title=struts.xml|borderStyle=solid}
> <constant name="struts.ognl.allowStaticMethodAccess" value="true"/>    
> {code}
> the getter is now reachable. 
> This applies only to <jsp:include> ; with <s:include>, the getter is ALWAYS reachable. 
> Seems to be some kind of side effect, maybe it should be verified and added to the documentation. [Originally posted here.|http://stackoverflow.com/q/19425754/1654265]



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)