<jsp:include> with variable number of <jsp:param> elements
865050May 27 2011 — edited Jun 15 2011I have a need where I have an unknown number of parameters to include with my call for a <jsp:include>. The parameters are stored in a map that I want to iterate over and include with my <jsp:include> request. I wanted to accomplish something like this.
<jsp:include page="mypage.jsp">
<c:forEach items=${paramsMap} var="param">
<c:param name="${param.key}" value="${param.value}"/>
</c:forEach>
</jsp:include>
I understand that the <jsp:include>/<jsp:param> construct does not allow for any foreign elements to exist within the body of the <jsp:include> tag.
Is there any way to accomplish this?