0

This is my jsp page to execute a query. When I run it, I get only 1 row from the courses table in the output. I was getting the right output a while ago, then I started working with the interface and realised that I don't get the correct output anymore. Can anybody point out the mistake? Thank you.

rs = statement.executeQuery("select * from courses");

<TABLE cellpadding="15" border="1" style="background-color: #ffffcc;">
<%

while (rs.next()) {
%>
<TR>
<TD><%=rs.getString(1)%></TD>
<TD><%=rs.getString(2)%></TD>
<TD><%=rs.getString(3)%></TD>
<TD><%=rs.getString(4)%></TD>
<TD><%=rs.getString(5)%></TD>
<TD><%=rs.getString(6)%></TD>
<TD><%=rs.getString(7)%></TD>
</TR>
} 
3
  • 2
    How many records are in the courses table? Make sure that it's more than one. Commented Apr 19, 2012 at 17:45
  • ya obviously, there are more than 100 Commented Apr 19, 2012 at 17:53
  • you may attach the name of the programming language used as a tag Commented Apr 19, 2012 at 17:58

1 Answer 1

1

Assuming your paste is correct you are missing the

<%
}
%>

around the end of the loop.

Sign up to request clarification or add additional context in comments.

1 Comment

everything was right, i just restarted the tomcat server and it worked fine. thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.