Hi
I am executing a sql query in wich I set maxRows="${noOfRows}" in the sql query. The param value comes from the search page form. It works fine on the first time through. However as soon as I call the next set of results via <a href="maxrows.jsp?start=<c:out value="${param.start + noOfRows}" />">Next Page</a>. The page return s nothing.
The thing is if I the value manualy - <c:set var="noOfRows" value="2" /> - it works fine. Returning 2 results for every page.
Why?? Any help welcome.
------------------
START THE FILE
------------------
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
<html>
<head>
<title>All Employees</title>
</head>
<body bgcolor="white">
<%-- Set number of rows to process --%>
<c:set var="noOfRows" value="${param.noOfRows}" />
<sql:query var="newsList" startRow="${param.start}" maxRows="${noOfRows}">
SELECT * FROM News
WHERE category LIKE ?
AND title LIKE ?
AND description LIKE ?
AND contributor LIKE ?
ORDER BY title
<sql
aram value ="%${param.category}%" />
<sql
aram value ="%${param.title}%" />
<sql
aram value ="%${param.description}%" />
<sql
aram value ="%${param.contributor}%" />
</sql:query>
<c:choose>
<c:when test="${newsList.rowCount == 0}">
No one seems to work here any more ...
</c:when>
<c:otherwise>
The following people work here:
<p>
<table border="1">
<th>Category</th>
<th>Title</th>
<th>Description</th>
<th>Contributor</th>
<c:forEach items="${newsList.rows}" var="row">
<tr>
<td><c:out value="${row.category}" /></td>
<td><c:out value="${row.title}" /></td>
<td><c:out value="${row.description}" /></td>
<td><c:out value="${row.contributor}" /></td>
</tr>
</c:forEach>
</table>
</c:otherwise>
</c:choose>
<p>
<c:choose>
<c:when test="${param.start > 0}">
<a href="maxrows.jsp?start=<c:out value="${param.start - noOfRows}" />">
Previous Page</a>
</c:when>
<c:otherwise>
Previous Page
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${newsList.limitedByMaxRows}">
<a href="maxrows.jsp?start=<c:out value="${param.start + noOfRows}" />">
Next Page</a>
</c:when>
<c:otherwise>
Next Page
</c:otherwise>
</c:choose>
</body>
</html>
------------------
------------------