Details
-
Improvement
-
Status: Closed
-
Trivial
-
Resolution: Cannot Reproduce
-
2.3.15.2
-
JBOSS EAP 6.01, Struts 2.3.15.2
Description
Trying to call an Action's getter from an included JSP, I get null:
MyAction.java
private String message = "The message I want to read..."; public String getMessage() { return message; }
main.jsp
<%@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>
fragment.jsp
<%@taglib prefix="s" uri="/struts-tags" %> <div> I'm a DIV from fragment.jsp <br/> Message from Action: <s:property value="message" /> </div>
If I set:
struts.xml
<constant name="struts.ognl.allowStaticMethodAccess" value="true"/>
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.