
We can retrieve the the data from data base simple jsp page:
Jsp Page:retrive.jsp
<%
Connection conn = null;
ResultSet rs = null;
Statement stmt = null;
String Query="SELECT * FROM STUD";
try {
Class.forName("com.ibm.db2.jcc.DB2Driver");
conn = DriverManager.getConnection("jdbc:db2://59.145.105.55:50000/tsttrial","trialadm","trial123");
stmt =conn.createStatement();
rs = stmt.executeQuery(Query);
%>
<TABLE cellpadding="5" border="1" style="background-color: #FGFGEE;">
<TR>
<TD>SELECT</TD>
<TD>STUDENT ID</TD>
<TD>STUDENT NAME</TD>
<TD>STUDENT AGE</TD>
<TD>STUDENT DEPT</TD>
</TR>
<%
int i=1;
while (rs.next()) {
%>
<TR>
<TD><input type="radio" value="<%=rs.getString(1)%>" name="r1" id="r1" onclick="displayResult(this.value)" ></TD>
<TD><input type="hidden" ><%=rs.getString(1)%></TD>
<TD><input type="hidden" ><%=rs.getString(2)%></TD>
<TD><input type="hidden" ><%=rs.getString(3)%></TD>
<TD><input type="hidden" ><%=rs.getString(4)%></TD>
</TR>
<%
i++;
} %>
<TR>
<TD colspan=1>now alter table</TD>
<TD><input type="button" id="add" value="add" onclick="doAdd()"></TD>
<TD><input type="button" id="modify" value="modify" onclick="doModify()"></TD>
<TD><input type="button" id="delete" value="delete" onclick="doDelete()"></TD>
<TD><input type="button" id="Cancle" value="Cancle" onClick="MM_goToURL('self','personnelTransaction');return document.MM_returnValue"></TD>
</TR>
</TABLE>
<%
}
by using this we can do update,delete operaion using checkbox Or radio button...From G RameshNaidu
catch (SQLException e) {
System.out.println("Error occurred " + e);
}
%>
</form>
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.