Monday, May 21, 2012

JSTL: remove last item from array

Was wondering if it's possible to remove the last item from an array using JSTL? Currently I'm using c:url to append parameters (from an array) to a hyperlink. I want to be able to remove the last parameter as well...

Here is the code for the c:url to append parameters

 <c:url value="search" var="url">
<c:param name="q" value="${q}"/>
<c:if test="${fn:length(fq) > 0}">
<c:forEach var="field" items="${fq}">
<c:param name="fq" value="${field}"/>

No comments:

Post a Comment