I'm writing this:
<c:forEach var="cntr" begin="1" end="10">
<c:set var="mycase" value="${param.mode${cntr}}" />
<c:if test="${mycase != null}">
<c:param name="mode${cntr}" value="${mycase}"/>
</c:if>
</c:forEach>
The result I want is for the redirect that sits outside of this to inherit the values of param.mode1
, param.mode2
, etc. as if I wrote:
<c:if test="${param.mode1 != null}">
<c:param name="mode1" value="${param.mode1}"/>
</c:if>
<c:if test="${param.mode2 != null}">
<c:param name="mode2" value="${param.mode2}"/>
</c:if>
<c:if test="${param.mode3 != null}">
<c:param name="mode3" value="${param.mode1}"/>
</c:if>
<c:if test="${param.mode4 != null}">
<c:param name="mode4" value="${param.mode2}"/>
</c:if>
<c:if test="${param.mode5 != null}">
<c:param name="mode5" value="${param.mode1}"/>
</c:if>
<c:if test="${param.mode6 != null}">
<c:param name="mode6" value="${param.mode2}"/>
</c:if>
All help appreciated.
` to print it and it works fine on both Tomcat 6 with web.xml set to Servlet 2.5 and Tomcat 7 with web.xml set to Servlet 3.0. In both cases I was using JSTL 1.2. I would however replace `${mycase != null}` by `${not empty mycase}` to skip empty strings as well.