Displaying some records at a time

does anyone know how to display only 10 records at one time from the database followed by the next button to display next 10 etc?

can anyone check this:
what does this mean?
String sql_2=request.getParameter("sql_2");
anything missing?
<%@ page language="Java" import = "java.sql.*" %>
<jsp:useBean id="myBean" scope ="session" class="bean.DataConnectionBean" />
<html>
<body bgcolor="#CCFFFF">
<%
String sql; //SQL string
int rowPerPage=10; //Record size of one page
int rowTotal; //Total records
int pageTotal; //Total pages
int pageIndex; //Pages waiting for display, from 1
pageIndex = Integer.parseInt( request.getParameter("page") );
rowTotal=Integer.parseInt( request.getParameter("rowTotal") );
String sql_2=request.getParameter("sql_2");
String sql_1= "select " +
"vin, " +
"ga_no, " +
"ga_build_date, " +
"deliver_date, " +
"model, " +
"year_code, " +
"engine_no, " +
"initial_mileage " +
"from vehiclemaster " +
"where ";
sql=sql_1+sql_2;
myBean.connect();
ResultSet rs=myBean.executeQuery(sql);
pageTotal = (rowTotal+rowPerPage-1) / rowPerPage; // Get total pages
if(pageIndex>pageTotal) pageIndex = pageTotal;
%>
<table border="0" cellpadding="2" cellspacing="0">
<tr>
<td align="left">
<div align="left">Total <%=rowTotal%> Records</div>
</td>
</tr>
</table>
<table border="0" width="844">
<tr bgcolor="#669966">
<th>VIN</th>
<th>GA#</th>
<th>build date</th>
<th>deliver date</th>
<th>model</th>
<th>model year code</th>
<th>engine#</th>
<th>initial mileage</th>
</tr>
<%
int absolute=(pageIndex-1) * rowPerPage;
for(int k=0; k<absolute; k++) rs.next();
int i = 0;
String LineColor;
while( rs.next() && i<rowPerPage && (absolute+i)<rowTotal ){
String col1=( ( ( col1=rs.getString(1) ) == null || rs.wasNull() ) ? "" : col1 );
String col2=( ( ( col2=rs.getString(2) ) == null || rs.wasNull() ) ? "" : col2 );
String col3=( ( ( col3=rs.getString(3) ) == null || rs.wasNull() ) ? "" : col3 );
String col4=( ( ( col4=rs.getString(4) ) == null || rs.wasNull() ) ? "" : col4 );
String col5=( ( ( col5=rs.getString(5) ) == null || rs.wasNull() ) ? "" : col5 );
String col6=( ( ( col6=rs.getString(6) ) == null || rs.wasNull() ) ? "" : col6 );
String col7=( ( ( col7=rs.getString(7) ) == null || rs.wasNull() ) ? "" : col7 );
String col8=( ( ( col8=rs.getString(8) ) == null || rs.wasNull() ) ? "" : col8 );
if (i % 2 == 0) LineColor="#DBECFD";
else LineColor="#C6E1FD";
%>
<TR bgcolor="<%= LineColor %>">
<TD><%=col1%></TD>
<TD><%=col2%></TD>
<TD><%=col3%></TD>
<TD><%=col4%></TD>
<TD><%=col5%></TD>
<TD><%=col6%></TD>
<TD><%=col7%></TD>
<TD><%=col8%></TD>
</TR>
<%i++;
}%>
</table>
<div align="center">
<table border="0" align="left">
<tr>
<td align="left">
<div align="left">Page <%=pageIndex%> / <%=pageTotal%> 
<%if(pageIndex<pageTotal){%>
<a href="QueryVehicleResult.jsp?sql_2=<%=sql_2%>&rowTotal=<%=rowTotal %>&page=<%=pageIndex+1%>"><img src="images/next.gif" border="0">
</a>
<%}%>
<%if(pageIndex>1){%>
<a href="QueryVehicleResult.jsp?sql_2=<%=sql_2%>&rowTotal=<%=rowTotal %>&page=<%=pageIndex-1%>"><img src="images/prev.gif" border="0">
</a>
<%}%>
</div>
</td>
</tr>
</table>
</div>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</body>
</html>
<%
rs.close();
myBean.close();
%>

Similar Messages

  • Displaying one record at a time

    Is any body able to help me? I need to display one record at a time from a Select statement.
    Could I copy the results of the Select query from a table into an array for later display or is there a better alternative.
    Please, any part knowledge with regard to the above would be usefull.
    Regards
    Eddie

    What application do you want to use to display the data?
    You can use "rownum" in your SQL statement to ensure that you only get record N of a query. Asktom has a good article on this sort of windowing
    http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:127412348064
    More commonly, however, you'll write a SQL query that returns all the rows, fetch a small number, display those to the user, and then fetch more records.
    Justin

  • Display one record at a time

    i am trying to display one record from my database on my jsp page per time using next and previous buttons to navigate. I have tried to implement this by putting the resultset in a vector and then tried to tried to dispaly data with no success.Please somebody help ,i been at this for two days with no success.Could someone give a concreate example to guide me

    Please post all code, i dont know how to put my resultset in a vector or arraylist.
    I need a First Previous next and Last link in asp it is called recordset paging or recordset navigation.
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
    <%@ include file="Connections/connEvents.jsp" %>
    <%
    int index = 0; //or wherever you wish to start
    if((String s = request.getParameter("index")) != null)
    index = Integer.parseInt(s);
    %>
    <%
    Driver DriverrsEvents = (Driver)Class.forName(connEvents_DRIVER).newInstance();
    Connection ConnrsEvents = DriverManager.getConnection(connEvents_STRING,connEvents_USERNAME,connEvents_PASSWORD);
    //PreparedStatement StatementrsEvents = ConnrsEvents.prepareStatement("SELECT * FROM hog_evenementen", ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
    //StatementrsEvents.setFetchSize(10);
    //ResultSet rsEvents = StatementrsEvents.executeQuery();
    PreparedStatement StatementrsEvents = ConnrsEvents.prepareStatement("SELECT * FROM hog_evenementen");
    ResultSet rsEvents = StatementrsEvents.executeQuery();
    %>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>HD - Evenementen-beheer</title>
    <style type="text/css">
    <!--
    body {
         background-color: #333333;
    -->
    </style></head>
    <script>
    function post(actValue)
    document.MyForm.action.value = actValue ;
    document.MyForm.submit() ;
    </script>
    <body>
    <table width="60%" border="0" align="center" cellpadding="0" cellspacing="0" class="">
    <tr>
    <td><table width="100%" class="" border="0" cellpadding="6" cellspacing="0">
    <tr>
    <td width="175" align="center" valign="bottom" bgcolor="#FF6600" class="">Evenementen-beheer</td>
    <td bgcolor="#333333" class=""><span class=""><span class="formField">
    </span></span></td>
    </tr>
    </table></td>
    </tr>
    <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="6">
    <tr bgcolor="#61ABD0" class="verdana10zwart">
    <td width="4"> </td>
    <td width="512" height="29"> <span class="">Evenementenoverzicht</span></td>
    </tr>
    <tr bgcolor="#61ABD0" class="">
    <td> </td>
    <td><table width="100%" border="0" align="center" cellpadding="6" cellspacing="0">
    <tr class="">
    <td width="252" class="smallText">record 1 van 1 etc moet hier komen <br></td>
    <td width="231" align="left" class="smallText"><table width="50%" border="0" align="center">
    <tr>
    <td width="23%" align="center"> Firs </td>
    <td width="23%" align="center"> <a href="index.jsp?index=<%= (index-10)%>">Previous</a></td>
    <td width="23%" align="center"><a href="index.jsp?index=<%= (index+10)%>">Next</a></td>
    <td width="23%" align="center">Last</td>
    </tr>
    </table>
    <br>
    </td>
    </tr>
    <tr bgcolor="#CCCCCC">
    <td>Thema</td>
    <td>Datum</td>
    </tr>
                   <%
                   int rowCount = 0;
                   while(rsEvents.next() && rowCount < 10) {
              rowCount++;
                   %>
    <tr>
    <td><a href="event_crud.jsp?ID=<%= rsEvents.getObject(ID")%">"><%= rsEvents.getObject("thema")%></a></td>
    <td width="231"><%= rsEvents.getObject("datum")%></td>
    </tr>
                   <% } %>
    </table></td>
    </tr>
    </table></td>
    </tr>
    <tr>
    <td bgcolor="#CCCCCC"><form action="event_frm_process.jsp" METHOD="POST" name="MyForm" id="MyForm">
    <table width="100%" border="0" cellpadding="6" cellspacing="0" class="verdana10zwart">
    <tr bgcolor="#CCCCCC">
    <td width="9"> </td>
    <td colspan="2"><span class="kop1"><br>
    Evenement toevoegen </span><span class="formField"><br>
    </span><br>
    <span class="formField"> </span></td>
    </tr>
    <tr bgcolor="#CCCCCC">
    <td width="9"> </td>
    <td width="107" class="downBorder">Thema:</td>
    <td width="383" class="downBorder"><input name="thema" type="text" id="thema"></td>
    </tr>
    <tr bgcolor="#CCCCCC">
    <td width="9"> </td>
    <td class="downBorder">Omschrijving:</td>
    <td class="downBorder"><textarea name="omschrijving" cols="40" rows="10" id="omschrijving"></textarea>
                   </td>
    </tr>
    <tr bgcolor="#CCCCCC">
    <td width="9"> </td>
    <td class="downBorder">Datum:</td>
    <td class="downBorder"><input name="datum" type="text" id="datum"></td>
    </tr>
    <tr bgcolor="#CCCCCC">
    <td width="9"> </td>
    <td class="downBorder">Tijd:</td>
    <td class="downBorder"><input name="tijd" type="text" id="tijd"></td>
    </tr>
    <tr bgcolor="#CCCCCC">
    <td width="9"> </td>
    <td class="downBorder">Lokatie:</td>
    <td class="downBorder"><input name="lokatie" type="text" id="lokatie"></td>
    </tr>
    <tr bgcolor="#CCCCCC">
    <td width="9"> </td>
    <td class="downBorder">Plaatje:</td>
    <td class="downBorder"><input name="plaatje" type="text" id="plaatje"></td>
    </tr>
    <tr bgcolor="#CCCCCC">
    <td width="9"> </td>
    <td class="downBorder"> </td>
    <td class="downBorder"><input name="insert" type="button" id="insert" onClick="post('insert');return false;" value="Evenement toevoegen"></td>
    </tr>
    <tr bgcolor="#CCCCCC">
    <td width="9"> </td>
    <td>
                   <input name="action" type="hidden" class="" id="action" value="">
    <% while(rsEvents.next()){ %>
                   <input name="ID" type="hidden" class="" id="ID" value="<%=rsEvents.getString("ID")%>">
                   <%
                   %>
                   </td>
    <td> </td>
    </tr>
    </table>
    </form></td>
    </tr>
    </table>
    </body>
    </html>
    <%
    rsEvents.close();
    StatementrsEvents.close();
    ConnrsEvents.close();
    %></a>

  • How can one display 1 record at a time

    How can one display a single record at a time.
    The next record should be displayed on the press of a button.
    Thanks in advance

    Vijaya,
    I have 3 regions, each contains a check box item,
    the label for which is dynamicaly generated through a SQL Select.
    ( &P1_ANSWER1. P1_ANSWER1 is the hidden item name)
    In the Region Source,
    I have put
    SELECT col1 from (SELECT col1, row_number() over(ORDER BY col1) row_number from prototype) WHERE row_number = :P1_QUESTION_NO;
    SELECT col3 from (SELECT col3, row_number() over(ORDER BY col3) row_number from prototype) WHERE row_number = :P1_QUESTION_NO;
    for each of the reqion that contains these items,
    Here the table is prototype and P1_QUESTION_NO is the hidden item.
    As directed I have included under Processes (after submit and computations) on button "Next Record" clicked:
    :P1_QUESTION_NO := ::P1_QUESTION_NO + 1;
    When I am doing this, the label seems to blank out.
    Thanks
    Message was edited by:
    faq123

  • Display saying record all the time

    Hi guys.
    I reported on here about 4 months ago that the display always says it recording all the time. I was told on here that the problem has been noted and would be fixed in a upcoming update, but it hadn't ?
    Anyone know when this is being fixed?

    Hi Markshim
    Are you still experiencing this issue?
    If so send us an email using the contact the mods link in my profile we can try to get more information on updates for you.
    Thanks
    Stuart
    BTCare Community Mod
    If we have asked you to email us with your details, please make sure you are logged in to the forum, otherwise you will not be able to see our ‘Contact Us’ link within our profiles.
    We are sorry that we are unable to deal with service/account queries via the private message(PM) function so please don't PM your account info, we need to deal with this via our email account :-)

  • Display specified record in run time

    I am using report wizard in report builder to develop a report and display it through the web browser.
    The Query that I entered is :
    Select * from empMaster
    Question: If I want to display some specified record in RUNTIME(like, Select * from empMaster where Name='Peter'), what should I need to do? I am using web report tester to generate the web report. Do I need to add something in HTML in order to display specified record.
    I have tried to use xml file which customize the report to control the output.
    xml show as following:
    <report name="testrpt" author="Generated" DTDVersion="2.0">
    <data>
    <dataSource name="testrpt">
    <select>
    Select * from empMaster where empMaster.email='Peter'
    </select>
    </dataSource>
    </data>
    </report>
    I have checked the trace file. it contain no error but it still display all the record in the table.
    null

    hello,
    the easiest way is to
    1) create a parameter e.g. called my_where
    2) rephrase the query to
    select * from empMaster &my_where
    if you then run the report you can pass the where-clause to your report as a parameter. you can also enforce the parameter-form by passing the additional parameter PARAMFORM=HTML
    regards,
    the oracle reports team

  • Report- not displaying some records in the report

    I have a query say q1 based on the query value. I am getting place holder colums obtained from a procedure. based on one of the place holder columns i want to display the data say i have place holder column err_ind if it y. i don't want to display the record in report.
    how can i do it ? ur help is much appreciated.

    Hi Praveen,
    Thanks for the response.
    Actually i did debug the program with the help of our technical guys but found nothing wrong in both the quality and the production system. We compared the program in both the systems and it seems to be same. I am exploring this issue. Will update the findings here.
    In case anyone has any suggestion please do suggest.
    Regards,
    Gokul

  • CachedRowSet displaying 5 records at a time

    hi all,
    Iam working on CachedRowSet is it possible to records in groups of 5 from a whole lot of 100 records?? pls let me know...
    thanks in advance
    Karthik

    <Statement>.setMaxRows(5);

  • When user clicks on the link ,it will display some record based on value

    Hi
    i want to create such a query/request in the Dashbord,when user click on it, it will open the other request in the same place based on the value it clicks.
    More detail idea about the question:
    for ex. i have created one query, which gives the following output.
    current_loan_amount Current_status
    now when user click the current_loan_amout ..........the detail page will be displayed.
    wchich will give the dettail about the Current_loan_amount.....like to whom the loan has been given,region,address,broker name etc..
    So if anybody knows anything about this.
    Guide me

    Yes you can create a navigate report where it displays the details for the amount user selected.
    You can enable navigation on the metric(column format-interation-navigate) and give the path of the other qyery.
    You just need to pass all the values that you need using "Is prompted" Filters.
    Hope it helps
    Prash

  • How to fetch some certain records at a time

    Hi everyone,
    I dont know how to fetch some records at a time,
    for some reason,there is not enouht memory.so I cant
    fethch all the records at a time.
    example, every time I only want to fetch 10
    records. Does anyone know that?
    thanks
    Krussi

    I think you may be getting setFetchSize(int) and setMaxRows(int) confused. I may have added to the confusion with my breaking out of the loop comment.
    setFetchSize(int) gives the driver a hint as to how many rows it should store in memory at a time internally, ie. within the driver. It has no real effect on how you write your program at all. Its only purpose is to limit memory usage by the driver. To limit the rows returned, use setMaxRows.
    For example, assume a result set has 20 rows and you use:
    rs.setFetchSize(5);
    while (rs.next()) {
       System.out.println("Rows: " + (++count));
    }  You still get a count from 1 to 20. However, internally the driver is only holding in memory 5 records at a time, after the 5 returned it will discard those and get the next 5. So instead of holding 20 rows, its only holding 5 at a time. If you change rs.setFetchSize(5) to rs.setMaxRows(5) you will only get a count from 1 to 5, the rest are silently discared and rs.next() returns false.
    Check your documentation to see if your driver supports the method. I believe many drivers don't. If not, I believe there is no way around multiple queries. Even if there is no rowid, as long as you order your queries you should be able to start again where you left off.
    Disclaimer: Both drivers I commonly use do not implement setFetchSize(int). Someone let me know if I've fudged something here.
    Good Luck

  • Multiple records displayed on form at one time- 2 lines for each record

    Hello,
    I have a canvas in which I want to display 8 records at at time, so in the data block I specified 8 as the "number of records displayed" value.
    However, the record has too many fields to display on 1 vertical line, so I want to split the fields into two separate lines, so there will still be 8 records but each in two lines.
    How do I do that?
    I'm using Forms 10g. The block is a database block using FROM CLAUSE QUERY , and the canvas is stacked.
    Thanks

    Sandy,
    You will need to set the "Distance Between Records" property for each item in the Multi-Record Block. This will increase the space between rows so you can stack them into two rows. Unfortunately, you can't set this property at the block - so you have to set it for each displayed item.
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.

  • Getting only a few records at a time.

    Using a Select * from. Is there an option where I get only so many records. This is for a console application. I wanted some thing where it will display only 3 records at a time. And then I have the option of viewing the next 3 and then the next 3 records
    and so on.
    Any one have any ideas.
    Merry Christmas EVERY ONE and thanks to all the members on msdn forums for helping me with my code.
    Joe Moody
    http://www.starfiresoft.com
    Pro-Forums
    Delta Force Barracks
    On the Frontlines

    Thanks. It doesn't matter as long as I can get it to work. The idea is to display 3 records at a time. Then the user should be able to go backward or forward in the list. Let me show you what I have. This will give you some idea on how I have it displaying
    the info.
    SqlCeCommand cm = new SqlCeCommand("SELECT * FROM users", cn);
    //cm.Parameters.AddWithValue("@tooid", num);
    //cm.Parameters.AddWithValue("@fromid", Id);
    SqlCeDataReader rd = cm.ExecuteReader();
    try
    while (rd.Read())
    Door.CursorRight(10);
    Door.WriteLn("|0C___________________________________________________");
    Door.CursorRight(10);
    Door.WriteLn("|0FId |04: |03" + rd["Id"].ToString() + " |0FName |04: |03" + rd["username"].ToString());
    Door.CursorRight(10);
    Door.WriteLn("|0FStatus |04: |03" + rd["status"] + " |0FDate Jointed |04: |03" + rd["joindate"]);
    Door.CursorRight(10);
    Door.WriteLn("|0C___________________________________________________");
    catch (Exception e)
    throw new Exception(e.Message);
    cn.Close();
    This is inside of a do loop. and at the bottom I have it waiting for user input. or the user can quit and return to the main menu.
    Door.WriteLn();
    Door.Write("|07Page |0F<|04||0F> |0FQ|09)|0BQuit |07Choice |04: |0C");
    cc = Char.ToUpper(Door.ReadKey());
    Above is my prompt. This waits for user input. and I use a switch to tell the software what to do. Any way if you want to know what Door.writeLn() is, Think of it like this "Console.Writeline()". This is just a library I use for the kind of programming I
    do.Any help would be great. Thanks and have a safe Xmas.
    Joe.
    http://www.df-barracks.com Delta Force Barracks
    http://www.starfiresoft.com Starfire Software

  • How can I display all records as a end user?

    I am applying for jobs with the state and every week they publish a list of new positions that have just been posted on the following link: https://forms.spb.ca.gov/bulletins/weekly.cfm
    and also at http://jobs.spb.ca.gov/wvpos/search_p_ejv.cfm?classcode=5393&criteria=associate%20governme ntal
    It is a .cfm but only displays 15 records at a time, I was wondering if there is a tag or way to have it display all 300 something records at once?  My ultimate goal is to get just the full table into a excel spreadsheet while retaining the HTML formatting so the links still work.
    My thought is that the state has set it up this way to only display a set number of records at a time, the data is not private or protected, I am simply seeking a easier way to access it in aggregate.
    Thank you in advance for your suggestions and help!

    I think your best hope is to ask the author of the CFM whether they provide any web service that can get you that data when you call it.  like.
    https://forms.spb.ca.gov/webservice.cfc?method=getJobsPostings&key={key_goes_here}
    There's a chance they may be regulating performance on the resultset, and don't want to return that many records at a time, pagination or not.

  • Display a record IF

    Hello all!
    I am trying to display one record at a time from my query of
    multiple tables if the username/password entries match the entries
    in the DB but am unsuccessful. The sequence starts from a list of
    names, where names is hyperlink to the page where the result of the
    query is displayed, but before getting to the results page, the
    user has to login.
    My question is how can I tell the hyperlink to go to this
    specific record (ie. contactID = 34 or whatever the user's ID is)
    only after entering a valid username/password. I tried
    1. from the login.cfm page: if successful, go to
    mypage.cfm?#contactID# (OR mypage.cfm?contactID)
    2. mypage.cfm?#contactID# and mypage.cfm?contactID as the
    link and both don't display the specific record. Any suggestions on
    what I am missing?
    TIA,
    Karla

    Hello All,
    Here is a more detailed explanation. Sorry it took too long.
    Anyway,
    not sure if I need cfparam because I only want to display one
    record at a time and not the entire query:
    <cfparam name="MaxRows" default="1"> <cfparam name
    ="StartRow" default="1">
    I actually have about 7 tables that I need to get information
    from, displaying several columns from each of them. Is INNER JOIN a
    good choice to use to display all of the info I need (all tables
    except the contact list contain dates)? Anyway, here's the code
    I've started:
    <cfquery name="qryIndividual" datasource="dshmat">
    SELECT ContactList.ContactID, ContactList.FirstName,
    ContactList.LastName, BIO.InitialRef2006, BIO.Bsfty2005,
    HWG.hwg2006, HWG.hwg2005
    FROM (ContactList INNER JOIN BIO on
    ContactList.ContactID=BIO.BioID) INNER JOIN HWG on
    ContactList.ContactID=HWG.hwgID
    ORDER BY ContactList.LastName
    </cfquery>
    This is the output that I am trying to display. But I'm stuck
    as to how to tell the DB to display a specific record if username
    and password are valid entries. If username is jdoe, then display
    jane doe's record only.
    FirstName LastName | InitialRef2006 | Bsfty2005 | hwg2006 |
    hwg2005
    jane doe 4/1/2006 6/5/2005 2/5/2006 8/6/2005
    I have login page, and this is where I want to initiate the
    query to display the right record of that individual.
    Any suggestions on where to start?
    TIA,
    Karla

  • A twist on only getting 20 records at a time

    Hi,
    Goal:
    Generate a search-engine like result page which displays 20 records at a time. Clicking "Next" will permit viewing the next 20 records, and so on.
    Current code:
    A JSP page posts a form to a servlet which, based on form selections, dynamically builds a SQL statement, which in turn is passed to a Bean which queries the DB and returns ALL records. Works great, but returns too much data for a web page (JSP).
    Problem:
    I have posted on the JSP forum, and have only been pointed to sites offering Custom JSP Tags which either query all records at once and only show you X at a time, (which I consider inefficient) or place the JDBC/SQL code in the JSP page, which I don't like either. So....
    Question:
    How do I achieve this? I have tried playing with the getMaxRoxs() and setFetchSize() methods to no avail. I am relatively new to this, but I think it has a lot to do with how JSP pages instantiate Beans (I.E: Every time the page loads, the bean is instantiated and all records are returned).
    Any help is greatly appreciated! I have tried so many things and searched the web, but have not found any concrete examples with code.
    - J

    My proposal was smth like this:
    ArrayList myData = new ArrayList();
    while (rSet.next()) {
        MyObjType myObj = new MyObjType(...);
        int i = 0;
        myObj.setAttribute1(rSet.getXXX(++i)); // getXXX is the proper method for the type of myObj.attribute1
        myObj.setAttribute2(rSet.getXXX(++i)); // getXXX is the proper method for the type of myObj.attribute2
        myObj.setAttributen(rSet.getXXX(++i)); // getXXX is the proper method for the type of myObj.attributen
        myData.add(myObj);
    session.setAttribute("myData", myData);
    ...Here MyObjType is the type (class) designed by you to hold one record of your result set. Example:
    For the
    TABLE BOOK
    ID NUMBER(10)
    TITLE CHAR(30)
    PRICE DECIMAL(2, 12)
    AUTHOR_ID NUMBER(10)
    Your MyObjType class will be probably named Book and will look like this:
    public class Book {
        private long id = -1;
        private String title = null;
        private double price = Double.NaN;
        private long authorId = -1;
        public long getId() {
            return this.id;
        public void setId(long id) {
            this.id = id;
        public long getAuthorId() {
            return this.authorId;
        public void setAuthorId(long authorId) {
            this.authorId = authorId;
        public String getTitle() {
            return this.title;
        public void setTitle(String title) {
            this.title = title;
        public double getPrice() {
            return this.price;
        public void setId(double price) {
            this.price = price;
    }So, you have an ArrayList of Book objects stored in your session object. Now you receive a request like this:
    gimmemydata?rowsfrom=20&rowsto=40
    Your JSP does just:
    <%
    ArrayList myData = (ArrayList) session.getAttribute("myData");
    int rowsFrom = -1;
    int rowsTo = -1;
    try {
        rowsFrom = Integer.parseInt(request.getParameter("rowsfrom"));
        rowsTo = Integer.parseInt(request.getParameter("rowsto"));
    catch (Exception ex) {;}
    if (rowsFrom < 0 || rowsTo < 0) {
        rowsFrom = 0;
        rowsTo = 20;
    %>
    <table>
    <%
    for (int i = rowsFrom; i < rowsTo; i++) {
        Book book = (Book) myData.get(i);
    %>
    <tr>
      <td><%= book.getTitle() %></td>
      <td align="right"><%= book.getPrice %></td>
    </tr>
    <%
    %>
    </table>
    ...It is as easy as that...
    Sorry, the closing brackets of the tags look a bit funny :-)

Maybe you are looking for

  • Application manager fails to install

    Joined the creative cloud and application manager fails to install

  • Please Explain in Detail

    Dear Experts, I am sending some text pls tell me Why ,When and What is the use of that? Text "10119 TRACE NAME CONTEXT FOREVER " "10195 TRACE NAME CONTEXT FOREVER "

  • Exchange 2010 Create new folder for select users off the root of the mailbox

    I need to create a new folder for a select set of users.  This folder needs to be off the root of their mailbox.  I  considered using a custom managed folder but we do not have the enterprise CAL's to support this option.  I only have about 15 users

  • Help another error when compliling

    says class,interface, or enum expected and highlights public static int sequentialSearch(int[] array, int value) please help dont be mean please import java.util.Scanner; public class ch8q3     public static void main(String[] args)         int[] val

  • Desperately need tech advice re: applecare replacement (i5 vs i7)

    Hi guys, Long story short, apple have finally agreed to replace my faulty 27 inch iMac 2.8Ghz i7 with a 27 inch 2.9Ghz i5 iMac. They are trying to tell me that the new model is "much faster" even though I paid for the initial uplift to an i7 when I p