iam trying to display the records from a database..using out.print to make an html table and display them. wanted to loop through the records and paginate them. is their a way out to loop thru the records without using the getter and the setter methods of java. thanks
What I usually do is use a Servlet, or a JavaBean to retrieve the records, store them in an ArrayList, or HashMap (depending on my needs), and use an Iterator to iterate through each Object and display it on the page. To do so, you can use JSTL, or a JSP scriplet. This way, you need only retrieve the records once, and if you need to access them multiple times, you simply access your data structure, not the database, as the latter is more costly. Of course, you do not necessarily need to use a getter method. You can simply retrieve the records, and generate the table structure immediately afterwards, though this is a rather crude way to do it, especially if you'll be accessing the data across multiple pages. [ May 02, 2004: Message edited by: Jeffrey Hunter ]
Originally posted by jyotsana dang: "is their a way out to loop thru the records without using the getter and the setter methods of java. thanks[/QB]
Yes you can if you use rowset.jar by usinbg that you can just populate the your resultset into CachedResultSet class and in jsp take out the CachedResultSet and loop thru the same.here you can close ur resultset after populating into CachedResultSet.