I am trying to figure out how I can check if a stored sql procedure I am running will return more than one row as a resultset. I have a forEach method which prints out the rows, but I cannot seem to be able to check later weather the resultset is one or more rows. I only need to know how to check if the result is MORE than one row. All help is appreciated. Here is a little snipplet of my jsp.
<tr>
<td>
<c:forEach var="row" items="${ aStoredProcedure }">
<fmt:formatNumber value="${ row.totalPrice }"pattern="#,##0.00"/>
<c:out value="${row.currency }"/>
(<c:out value="${ row.id }"/>)
</c:forEach>
</td>
</tr>
The above code works well and I included it here in case there is a way to use it somehow to check if there are more than one row returned (I had to rename some variables for liability reasons) but now I need to check weather or not the result gives more than one row, and I need to do this in a different table row. So far I've tried:
<c:if test="${ aStoredProcedure >'1'}">
<tr>
<td>
<%--do something here if it is bigger than 1--%>
</td>
</tr>
</c:if>
and
<c:if test="${ row >'1'}">
<tr>
<td>
<%--do something here if it is bigger than 1--%>
</td>
</tr>
</c:if>
But these don't work at all.. only returns JasperExceptions. I found good solutions for how to check if a resultset has data or not, but nothing for how to do it entirely in JSP and preferably without using java. As you can probably tell, I am very new to JSP and will appreciate any help on how to figure out how to check if the procedure returns more than one result.
I have a controller class as a java class, which houses the model that I use to put the model in place:
model.put("aStoredProcedure",managerClass.nameofMethodICallFromMngrClass(aValueIUseToCallMethod(),anotherValueIUseToCallMethod()) );
and for the time being I had to add a new part to the model to get the check done:
model.put("aStoredProcedureSize",managerClass.nameofMethodICallFromMngrClass(aValueIUseToCallMethod(),anotherValueIUseToCallMethod()).size() );
I then check the size to be bigger than 1 before doing anything on the JSP side:
<c:if test="${ aStoredProcedureSize gt 1}">
<tr>
<td>
<%--do what I want here--%>
</td>
</tr>
</c:if>
This works well and does what I want, but I had to make changes to the java side and was wondering if the checking of the size could be done somehow entirely on the JSP side without having to make a new part to the model?