Click to See Complete Forum and Search --> : tables not displaying all the rows values...


abhit_kumar
01-12-2005, 03:04 AM
i have used servlet for displaying inserted values in the oracle database.

it retrieved values from hrml page..there is table which is shown as below:


<tr>
<td><input type="text" name="Ac.code" size="5" maxlength="5"></td>
<td><input type="text" name="slcode" size="10" ></td>
<td><input type="text" name="debit" size="12" onkeyup="addT('tdebit',this)"></td>
<td> <input type="text" name="credit" size="12" onkeyup="addT('tcredit',this)"></td>
</tr>
<tr>
<td><input type="text" name="Ac.code_2" size="5" maxlength="5"></td>
<td><input type="text" name="slcode_2" size="10" ></td>
<td><input type="text" name="debit_2" size="12" onkeyup="addT('tdebit',this)"></td>
<td> <input type="text" name="credit_2" size="12" onkeyup="addT('tcredit',this)"></td>
</tr>

the values taken from html page and it is inserted into the database..my insertion of values is working..i have used addbatch method for the same..due to the insertion of multiple values..

i have used following query..(this is the jsp page for displaying values)


PreparedStatement sql = conn.prepareStatement("SELECT * FROM pay_header,pay_detail where pay_header.vou_no like 'BP%' and pay_detail.vou_no='"+temp+"' ");

results = sql.executeQuery();

while(results.next())
{

ac_code = results.getInt("ac_code");
sl_code = results.getInt("sl_code");
db_amt = results.getFloat("db_amt");
cr_amt = results.getFloat("cr_amt");

out.println("<tr><td> <INPUT TYPE='TEXT' NAME='ac_code' size='12' value='" + ac_code + "' readonly </td>");out.println("<td>

<INPUT TYPE='TEXT' NAME='sl_code' size='12' value='" + sl_code + "' readonly </td>");

out.println("<td><INPUT TYPE='TEXT' NAME='db_amt' size='12' value='" + db_amt + "' readonly </td>");

out.println("<td> <INPUT TYPE='TEXT' NAME='cr_amt' size='12' value='" + cr_amt + "' readonly </td></tr>");


my problem is that after insertion in database...it displays only first row of the table..the second row doesnot display in the jsp page..


as the both the rows are inserted in database(that i have checked)..but its not displaying....

help me for the same...

makes the changes in my query..if is there any problem in this..


thanx

ray326
01-12-2005, 10:00 AM
#1 you should not be writing HTML from the servlet. The servlet should prepare a bean as a collection of your objects built from the database, put that into the request and forward to a JSP that will display the content of that bean.

Should the missing row appear in the middle of the new result set or is it at a boundary?