I wrote the following code in a JSP file:
<c:catch var="e">
<%
int accountNumber = Integer.parseInt(request.getParameter("accountNumber"));
int depositAmount = Integer.parseInt(request.getParameter("depositAmount"));
%>
<sql:query var='account' dataSource="jdbc/bank">
select * from account where AccountNumber=<%= accountNumber %>
</sql:query>
<c:choose>
<c:when test="${account.first() == false}">
<p>Account not found</p>
</c:when>
<c:otherwise>
<h3>Deposit Made</h3>
<p>Account number: <%= accountNumber %></p>
<p>Deposit amount: <%= depositAmount %></p>
<p>New balance: </p>
</c:otherwise>
</c:choose>
</c:catch>
<c:if test="${e != null}">
error
</c:if>
The problem I am having is that the following code throws an javax.el.MethodNotFoundException: Unable to find method [first] with [0] parameters exception:
<c:when test="${account.first() == false}">
<p>Account not found</p>
</c:when>
I need to access the account variable in the sql:query so I can check to see if a first row exists.