struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrea Ligios (JIRA)" <j...@apache.org>
Subject [jira] [Created] (WW-4228) OGNL Basic: if AllowStaticMethodAccess is set to true, JSP fragments included with <jsp:include/> can access Action members, otherwise they can't.
Date Fri, 18 Oct 2013 08:27:41 GMT
Andrea Ligios created WW-4228:
---------------------------------

             Summary: 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
         Environment: JBOSS EAP 6.01, Struts 2.3.15.2
            Reporter: Andrea Ligios
            Priority: Trivial


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.1#6144)

Mime
View raw message