Struts2: How to read parameters from <jsp: include>
When I enable JSP, or <jsp:include /> , and specify the parameters - they are perfectly accessible EL ${param.XXX} , but not OGNL %{#parameters.XXX} .
For instance:
<jsp:include page="fragment.jsp"> <jsp:param value="foo" name="bar" /> </jsp:include> and in the .jsp snippet
value of foo in EL : ${param.bar} value of foo in OGNL : <s:property value="%{#parameters.bar}" /> WHY??? What should be used instead in Struts tags?
Note: with <s:include/> instead of <jsp:include/> parameter is not available even with EL.
I recently ran into this problem. I found that the parameters in <s:include> not stored in the request.parameters ActionContext object, but are stored in the HttpServletRequest JSP page. Thus, parameters can be obtained using EL(${param.xxx}) or <% request.getParameters("xxxx") %> , but we will not be able to execute (struts) ongl. Because the parameters are not in the ActionContext .
If you insist on using ongl, you can add parameters to the ActionContext via jsp <% %> ActionContext <% %> or EL, and then you can get the parameters via ongl.