I apologize if this is off topic and JSP questions should be sent
elsewhere.
I'm new to JSP (coming from an ASP background) so please forgive me.
I've got a class method that returns a ResultSet object. I
instantiate an object of the class and call the method from a stand-
alone Java application and it seems to work okay. I iterate through
the ResultSet using 'rs.getString(i)' where i is 1-3 from the three
columns returned. This subscript of '1' actually displays the first
column, which I would think would be '0' but whatever... When I take
this code and put it in my JSP, it doesn't like the subscript '3' and
actually displays the second SQL column as subscript '1'. Thought
this looked more normal so I changed the range to 0-2 and I error out
on '0' as well. Both write out something like this to my web server
error log: 'root cause: java.sql.SQLException: Invalid column index'
Any ideas? Dumb question?
--- JSP CODE ---
<%@page contentType="text/html"%>
<%@ page import="java.io.*, java.lang.*, java.sql.*, Memo_Tracker" %>
<%
String page_Title = "Memo Tracker";
Memo_Tracker myMemo = new Memo_Tracker();
ResultSet rs = myMemo.report_Memo(3,1);
%>
SOME HTML ENDING WITH BODY TAG
<%-- <jsp:useBean id="beanInstanceName" scope="session"
class="package.class" /> --%>
<%-- <jsp:getProperty name="beanInstanceName"
property="propertyName" /> --%>
MORE HTML SETTING UP A TABLE
<%
while (rs.next()) {
out.println("<tr>");
out.println(" <td>" + rs.getString(1) + "</td>");
out.println(" <td>" + rs.getString(2) + "</td>");
// out.println(" <td>" + rs.getString(3) + "</td>");
out.println("</tr>");
}
%>