I want to do something like this:
<c:import url="${myvar.url}">
<c:forEach items="${myvar.params}" var="param">
<c:param name="${param.name}" value="${param.value}"/>
</c:forEach>
</c:import>
And I get this error:
Illegal child tag in “c:import” tag: “c:forEach” tag
Apparently, the c:import expects c:param within it and it sees a c:forEach instead.
I get the same problem if I try a jsp:include and jsp:params.
Any help ?
You won’t be able to do it with either c:import or jsp:include.
If this is something you’re going to do more than once, you could write a tag file, such as:
Save that as “
importParamMap.tag” in your “WEB-INF/tags” folder. To call it in a page, include the tags directory and treat it as any other tag: