To display 5 records out of 10 in String array

HI ALL,
Can anybody tell how to display first 5 records initially & rest 5 next time.
this is wht i done
String [] names = { "a", "b", "c", "d","e","f","g","h","i","j" };
for(i=0;i<names.length;i++) // if i write for(i=o;i<5;i++) it display 5 records
System.out.println(names); // here display all records
i want initially to display first five records
is there other way.
actually i want this code in JSp when click on next button next 5 records will be displayed

ok in you action performed method were you button is clicked
you would need a global int as a pointer and local int say count
//global int pointer initially set to 0
int count  =0;
while(count<5 && pointer<names.length())
    System.out.println(names[pointer]);
    count++;
    pointer++;
}that should work.
No to sure what Jsp is though.

Similar Messages

  • Database displaying all records when no records are in database

    SEARCH PAGE:
    <form id="searcMennuu" name="searcMennuu" method="post" action="VehicleListing.php">
    <select name="vehicles" id="vehicles">
    <option value="allCars" selected="selected">ALL</option>
    <option value="Sedan">Sedan</option>
    <option value="Jeep">Jeep</option>
    <option value="Motorbike">Motorbike</option> </select> <input name="radioVehicle" type="radio" id="searchSale" value="searchSale" />
    Vehicles for Sale</label>
    <label>
    <input type="radio" name="radioVehicle" id="searchRent" value="searchRent" />
    Vehicles for Rent</label> <input type="submit" name="searchButton" id="searchButton" value="Search" />
    </form> RESULTS PAGE:
    mysql_select_db($database_ddd, $ddd); $query_rsTest = "SELECT `year`, `model` FROM vehicles";
    if (isset ($_POST ['vehicles'])) {
    $parSearch = mysql_real_escape_string ($_POST['vehicles']);  if($_POST['vehicles'] == "Sedan"){
    $query_rsTest.= " WHERE vehicle_type LIKE '%$parSearch%'";
    } $rsTest = mysql_query ($query_rsTest, $ddd) or die(mysql_error());
    $row_rsTest = mysql_fetch_assoc ($rsTest);
    $totalRows_rsTest = mysql_num_rows ($rsTest); <div class="showPage"><?php echo $totalRows_rsTest ?></div><?php do { ?>
     <?php if ($totalRows_rsTest > 0) { // Show if  recordset not empty ?> 
    <div class="output" id="Results">
    <p><?php echo $row_rsTest['year']; ?></p>
    <p><?php echo $row_rsTest['model']; ?></p>
    </div>
    <?php } // Show if recordset empty ?>
    <?php } while ($row_rsTest = mysql_fetch_assoc($rsTest)); ?> 
    1. I think i found out why the hide region is not working, whenever i search for something that is not in my database or does not satisfy my search criteria the results page is displaying all records in the database. However i don't know how to fix that. Can someone please help me?
    2. Also i'm trying to find out how i would display ALL vehicles in my database either for rent or sale, i dont have a field in my database for "ALL" so i'm not sure where to start. Thanks in advance

    Which BOBJ version do you use?
    Which kind of data source are you retrieving data from?
    Regards,
    Stratos

  • In reports, i want to display currency field out put with diff currencies

    Hi all
    in reports, i want to display currency field out put with different type of currencies like 1st record in rupees 2nd record in dolors 3rd record in       
    Euros. for this i should not use any tables and any currency fields and any functional modules. pls give replay urgently.

    Hi swamy,
    so sorry, but you have to use some of the objects you do not want to:
    Currency values in ABAP are stored in currency fields (type CURR). If they are stored in structures or database, every CURR field must be connected to a CUKY field (currency key).
    Displaying data using WRITE statement four output on a list is obsolete technique, you may use the use WRITE with the option CURRENCY c to format according to currency c in table TCURX.
    SAP recommends to use ALV technique. If you use ALV to display structure data, then create a dictionary structure with currency value and currency key. The rest goes automatically.
    Believe me: It is much easier and more reliable.
    Regards,
    Clemens

  • Display multiple records as sub-sections in the same report.

    I am using Crystal Reports (VS-2005).
    In a report, I have various sub-sections in the Details section. Each section represents a category and is connected with SQL command which uses LEFT OUTER JOIN.
    The first section is the main section and the subsequent sections are the child sections.
    Sometimes, a sub-section (other than the first main sub-section) picks multiple records of that category. In this case the report extends to multiple pages. Each report displays one record of this sub-section.
    I want to show the the same sub-section multiple times in the same report as opposed to multiple reports that are now automatically generated by Crystal Reports.
    How to handle this issue?

    This is a .NET programming forum related to Crystal Reports. Your question is best suited for our report design forum below. Also, when you post your question it will be helpful if you use report design terminology. We have elements like Report Header, Page Header, Groups, and Details sections. Just mentioning "sections" doesn't give us a good idea about what you are attempting to do.
    Check out the grouping options and see if it helps. You might need to create a formula to help you with your grouping though.
    If you like, I can move this to the design forum.
    [SAP Crystal Reports Design|SAP Crystal Reports;

  • Display newline using out.println

    Can anyone tell me how can I put a new line using the out.println?
    Because I wanna to display the record in the following format
    which is
    Username : xxx
    UserID : xxx
    Age : xxx
    so on .....
    Actually I wanna to do it in a table form(HTML)....
    Can anyone suggest a better way to do it?

    Put the stuff in table then:
    <table>
    <tr>
    <td>username=<%=xyz%></td>
    </tr>
    <tr>
    <td>pwd=<%=abc%></td>
    </tr>
    </table>
    HTH,
    J.Clancey

  • Currency fields in Salesforce reports display as "[Record]" in Power Query

    Currency fields in Salesforce reports display as [Record] in excel when using power query.    Can include screenshots due to forum rules.

    Thanks - that helped me figure it out.
    IF you right click on the source and click edit to get into edit mode on the query, then you have the option to expand the record.  Doing this and saving does the trick.  
    Will try and post some screenshots later if others run into this.

  • Response time low to display 2700 records

    In my program , i have tried to display 2700 records from Database using JSP.
    But the response time is very slow. How do i overcome this problem.
    My architecture is
    JSP - EJB - HelperClass - DB.

    Find out where the performance bottleneck is
    1) Database -> use PreparedStatements,
    reuse an open database connection
    2) JSP -> Check your string handling, use StringBuffer() for appending
    lots of strings together
    3) Network response -> Maybe try defining a static IP address for your
    server
    regards,
    Owen

  • Monthly  search &  how to display 15 records per page with next & back btn

    hi
    i m trying to find records using select statement.
    i want to get record pagewise. its a simple code. i m sending
    plz if anybody have any solution or suggestion try to solve it out
    one more thing i have a field in my database as a date.
    i want a monthly search. what will be query.
    i'll be thankful 4 any help
    regards
    <html>
    <head>
    <title>search</title>
    </head>
    <body>
    <body bgcolor="#B0C4DE">
    <%@ page language="java" import="java.sql.*"%>
    <form>
    <table width="45%">
    <%
        String param = request.getParameter("Str");
        if(param == null)
           param="";
    %>
            <td width="128"><font color="#800080"><h3>Enter Date</h3></font</td>
              <td width="150">
              <input type="TEXT" name="Str" size="15" />
              <form action="menu01.jsp" method="post" name="ser_chk1.jsp"></td>
              <td>
            <BUTTON name="post" type="submit"><img src="m162.gif" width="25" height="25" border="" alt="Search Now" /></BUTTON></td>    
    </form>      
    </tr>
    </table>
    </form>
    <%  
      if(!param.equals("")) {
       Connection con = null;
       ResultSet rs = null;
       PreparedStatement pstmt = null;
      try
          Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          con = DriverManager.getConnection("jdbc:odbc:database");
          String sql = "SELECT * FROM data, data1  WHERE gate_pass=gate_pass1 AND ser_no=ser_no1 AND nat_ure=nat_ure1 AND ven_dor=ven_dor1 AND sou_rce=desi_g1 AND desi_g=sou_rce1 AND d_o_s LIKE ?";
          pstmt = con.prepareStatement(sql);
          pstmt.setString(1, param);
          rs = pstmt.executeQuery();  
    %>
    <table border="" width="1200">
    <tr>
            <th><font color="#800080">Serial No</font></th> 
            <th><font color="#800080">Nature</font></th>
            <th><font color="#800080">Description</font></th>
            <th><font color="#800080">Problem</font></th>       
            <th><font color="#800080">Vendor</font></th>
            <th><font color="#800080">Employee No</font></th>
            <th><font color="#800080">Employee Name</font></th>
            <th><font color="#800080">GatePass</font></th>
            <th><font color="#800080">Return Status</font></th>
            <th><font color="#800080">Source</font></th>
            <th><font color="#800080">Desigation</font></th>
            <th><font color="#800080">Source Out</font></th>
            <th><font color="#800080">In Desi</font></th>
            <th><font color="#800080">Vendor In</font></th>
            <th><font color="#800080">Vendor Out</font></th>
            <th><font color="#800080">Back Desi</font></th>
            <th><font color="#800080">Employee No</font></th>
            <th><font color="#800080">Employee Name</font></th>
            <th><font color="#800080">Remark</font></th>      
    </tr>
    <%
           while(rs.next()) {
          String serno = rs.getString("ser_no");
          String nature = rs.getString("nat_ure");
          String description = rs.getString("desc_i");
          String problem = rs.getString("prob_lem");
          String vendor = rs.getString("ven_dor");
          String empno = rs.getString("emp_no");
          String empname = rs.getString("emp_name"); 
          String gatepass = rs.getString("gate_pass");
          String retsts = rs.getString("ret_sts");
          String source = rs.getString("sou_rce");
          String desi = rs.getString("desi_g");
          String dos = rs.getString("d_o_s");
          String did = rs.getString("d_i_d");
          String vrd = rs.getString("v_r_d");
          String rfv = rs.getString("r_f_v");
          String dtd = rs.getString("d_t_d");
          String empno1 = rs.getString("emp_no1");
          String empname1 = rs.getString("emp_name1");
          String remark = rs.getString("re_mark1");
    %>
    <tr>
        <td><%= serno %></td>
        <td><%= nature %></td>
        <td><%= description %></td>
        <td><%= problem %></td>
        <td><%= vendor %></td>
        <td><%= empno %></td>
        <td><%= empname %></td>
        <td><%= gatepass %></td>
        <td><%= retsts %></td>
        <td><%= source %></td>
        <td><%= desi %></td>
        <td><%= dos %></td>
        <td><%= did %></td>
        <td><%= vrd %></td>
        <td><%= rfv %></td>
        <td><%= dtd %></td>
        <td><%= empno1 %></td>
        <td><%= empname1 %></td>
        <td><%= remark %></td>
    </tr>
    <%
        finally {
                  if (rs != null) rs.close();
                  if(pstmt != null) pstmt.close();
                  if (con != null) con.close();
    %>
    </table>
    </body>
    </html>

    Hi Shi_san
    for monthly search you can use the below query..
    String qry="Select * from tablename where datefield is between '"+value1+"'" and '"+value2+"' ;for Value1 and Value2 you need to put two fields in your form....and user has to enter value like mm/dd/yyyy .....if you don't want to do that then put one option for user which month he wants to see the data...if user select month March then select value1=03/01/2006 and value2=03/31/2006...something like that...
    now for Next and Back button you must be having uniqueID in your table,,,
    First Time display this query.....
    String disprec="Select Top 15 *  from table1 order by uniqueID DESC ";now you need to retrieve last record's value from this page and pass it into you link of Next Button....
    If you click next button then display below query....
    String disprec="Select Top 15 *  from table1 where uniqueID<val1 order by uniqueID DESC ";c if it works...
    Vishu

  • RPUAUD00 Reports is not displaying previous records details just new records

    Hi Guru,
    Need some input, I am trying to get infotype log. I maintain V_T585A/B/C for Infotype 2.
    Can you check screen shot of the same and confirm why its not displaying old records .
    Regards,
    Vijay Agarwal

    did you select long term documents? - Long-term documents are used for revision purposes, in other words to find out who changed, deleted or created what and when. check changes of note no. 44206 means, table PCL4 can get pretty large and as a follow up the report RPUAUD00 might take a long time to evaluate the logged changes in the infotype data. Please note that when an archive is selected, then the found archive is read until the record is found. This can take a lot of time (taken into account the access to the file itself), especially with large files. That is currently standard design behavior. But you can run regulary report RPUAUDDL to delete old entries in PCL4. PCL4 contains change documents for Master Data and applicant admin. In PCL4 there are four clusters: LA, LB, SA, and SB.  It contains the data created by using the 'write infotype document' function.  LX are long-term documents, SX are short-time documents. 'A' stands for employee, 'B' for applicant.  The 'write infotype document' function is maintained in tables T585A, T585B, and T585C.

  • 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 all records from 4 select list

    Hi,
    trying to associate 4 select list where i could display all records from a list linked to an other list.
    1./ Created an item for each select list
    P1_employee_name
    P1_departments
    P1_employee_type
    P1_locations
    2./Set both null and default values to '-1' for each item
    3./Associated these items to source columns in the Region:
    where employee_name=:P1_employee_name
    or :P1_employee_name ='-1'
    and departments=:P1_departments
    or :P1_departments ='-1'
    and ......
    When running the report, couldn't display all records from a given list associated to an other list.
    e.g: Display all emp and type of emp for sales dept in Paris.
    Thks for your help

    I believe the issue is that you need to group your predicates such as:
    where (employee_name=:P1_employee_name
    or :P1_employee_name ='-1')
    and
    (departments=:P1_departments
    or :P1_departments ='-1')
    Also, if you are not already using the "select list with submit" type items, these work great for this case as the page will be submitted when the user changes the value of employeenam and the report will then reflect this change.

  • Form does not display all records from table

    Hi guys
    I modified one form that was based on a signle DB table. I removed certain fields from the table and added some extra fields to that table. Then based on the new table I also modified the form and removed the text items related to old fields in the table and added new text items pointing to the new fields now. II have checked all the new items properties and they have don't seem to be wrong or so. But now the problem is the form does not display all the records from the table. before it used to display all records from the table when qureied but not now. It only certain records from the table containing all new data and also old data but the form does not display other records though I don't see any obvious discrepancy. Remember that the before doing the modifications, I have table back for the old, created another table that contained new records for the new fields, and then I inserted the old records and updated the new table data in the new table with these new table values. So this way I have got my new table. Could someone help why the new modified form fails to display all records from the new table updated table though it display some of them successfully.
    Any help will be appreciated.
    Thanks

    hi
    Set the block property of "Query All Records" to "YES"
    hope it will work.
    Faisal

  • Report for displaying info record scale prices

    Hi all,
    Can any one provide me the sample code for a report  displaying info record scale prices.
    Thanks,
    Suresh

    Check t.code MEKP.

  • 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

  • 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>

Maybe you are looking for

  • SQL Developer Data Modeler: Logical model, unable to create arc

    I have a logical model in SQL Developer Data Modeler. Entity A has two 'incoming' foreign key relations to entities B and C. Both releations have the same optionality and cardinality. I want to place both relations in an arc. I see the buttons in my

  • I can't change the maximum number of calls and busy in 8941

    Hi Experts, I have 8941 model with Camera and I can't make a second call, I tried to change the maximum number of calls, but I couldn't change it's 3 just by default, Is there any way to solve this issue? Thanks Mohammad Saeed 

  • Error 1402 while installing iTunes.

    Hey guys, I have a problem with installing iTunes, and I've come to believe it's called "error 1402". Here is what it looks like: I have no idea how to fix it, and the solution Apple provides didn't help me.

  • Workaround for iPhone smart playlist bug

    There is a bug (do a search for smart playlist in this forum) with smart playlists not displaying the correct songs on the iPhone. I just tried something that seems to have worked... I have a playlist in iTunes called "Recently Added" which I want to

  • DESPERATE... Indesign won't open most of my Indesign files???

    Sorry if my message sounds panicked but I am going out of my mind with worry. I am working late on a deadline to get a job done, my inDesign has decided to give me the following message when I open any of the many 100 inDesign files I have made: 'Can