Using OGNL to get parameters

On one JSP page, I include another JSP page and pass the parameter:

<jsp:include page="/WEB-INF/somepage.jsp" flush="true"> <jsp:param name="location" value="menu"/> </jsp:include> 

On the included page, I can access the parameter using EL. It works:

 ${param.location} 

But I cannot use the OGNL equivalent to get the same parameter. None of these works:

 #parameters.location #parameters['location'] %{#parameters.location} %{#parameters['location']} 

I know there is a workaround using <s:set var="location">${param.location}</s:set> or <c:set var="location">${param.location}</c:set> and then using OGNL: #location , but I want to avoid this. I also do not want to use scripts.

+4
source share
1 answer

Struts2, equivalent to the include tag, <s:include , which you should replace in your code, then apply <s:param to parameterize it.

 <s:include value="/WEB-INF/somepage.jsp"> <s:param name="location" value="menu"/> </s:include> 

after that you can use OGNL.

+2
source

All Articles