Link to Self With Parameter Passing : Form Action « JSTL « Java Tutorial






<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>

<c:set var="totalCount" scope="session" value="100"/>
<c:set var="perPage" scope="session" value="20"/>

<c:forEach
    var="boundaryStart"
    begin="0"
    end="${totalCount - 1}"
    step="${perPage}">

    <a href="?start=<c:out value="${boundaryStart}"/>">
      [
        <c:out value="${boundaryStart}"/>
         -
        <c:out value="${boundaryStart + perPage - 1}"/>
      ]
    </a>
</c:forEach>

<c:forEach
    var="current"
    varStatus="status"
    begin="${param.start}"
    end="${param.start + perPage - 1}">
  <c:if test="${status.first}">
    <ul>
  </c:if>
  <li><c:out value="${current}"/></li>
  <c:if test="${status.last}">
    </ul>
  </c:if>
</c:forEach>
  Download:  JSTLLinkToSelfWithParameterPassing.zip( 939 k)








24.18.Form Action
24.18.1.Post to the Same Page
24.18.2.Link to Self With Parameter Passing
24.18.3.JSTL Form Parameters
24.18.4.Use Form Parameter as Request Parameters in JSTL