Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 12th, 2005, 03:52 AM
Authorized User
 
Join Date: Oct 2004
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default tables not displaying all the rows values...

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


 
Old January 12th, 2005, 06:12 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Use a result set. Result sets hold all records from query, not just one. Result sets are scrollable meaning you can navigate around your records.

ResultSet rs; // where rs is the name of your result set

st = conn.prepareStatement(query); //where query is the variable holding your sql

rs = st.executeQuery();

while (rs.next()) {

// add your output code

} // end while

 
Old January 17th, 2005, 12:03 AM
Authorized User
 
Join Date: Oct 2004
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i have already used ResultSet..but the result is same...






Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying query from three tables slims07 .NET Framework 2.0 8 April 2nd, 2008 10:47 AM
Matching rows in two tables donevco Access 13 April 25th, 2007 03:27 PM
Displaying tables in Visual C++ azhure Visual C++ 0 July 23rd, 2005 03:23 PM
Rows to columns by joining to tables subhasis SQL Server 2000 0 February 7th, 2005 09:26 AM
tables not displaying all the rows values... abhit_kumar Servlets 0 January 12th, 2005 10:15 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.