I'm trying to display one record at a time in
jsp using resultset but I'm finding this very hard to do.
I gain access to a connection generated in
servlet and use this to access database as follows:
<FORM method="POST" action="/ProcessClients.jsp">
<%
Statement stmtClients;
ResultSet rsClients;
Connection connection = (Connection) session.getAttribute("connection");
String queryClients = "SELECT * FROM clients";
stmtClients = connection.createStatement();
rsClients = stmtClients.executeQuery(queryClients);
ResultSetMetaData rsmdClients = rsClients.getMetaData();
if( rsClients.next()){
System.out.println(rsClients.getString("clientID"));
%>
<TABLE border='1' bordercolor='#rrggbb' cellpadding='2' cellspacing='2'
width='100%'>
<TR>
<TD align='right'>Client ID</TD><TD align='left'><INPUT type='text' name='clientID' value='<%= rsClients.getString("clientID") %>'></TD>
<%
}
%>
<TR>
<TD ALIGN=CENTER><INPUT TYPE="SUBMIT" VALUE="Next" STYLE="font-family:sans-serif;font-size:small;
font-style:italic; background:FF9933 none; color:#000; width:4em"></TD>
</TR>
</TABLE>
But how do I the same jsp to display the next record in database in jsp when next button is selected, I'm quite new to this and I'm not getting very far so any help would be appreciated....
Cheers Joe