Database using in jsp : want to show 10 records on  a single page

hi ,
my probem is i want to show 10 records from database to html page using jsp in a table,with two links Next and Rrevious.when user click next table will show next 10 records and so on.
and when user click on previous then table have to show previous 10 records to table.
how can i do this i m using rs.abolute(), but it doesn't do as i want.
plz help me

afterv accessing alll the data from databse put them into an array and put this array in user's session and now when user clicks on next or previous extract the data from the array not from database it ill also decrease server load..

Similar Messages

  • I want to show records on multiple pages in jsp

    hi,
    i am taking records from database through resultset.resultset contains so many records ,i want to show those records page by page on JSP.when user clicks on "next" button then next records should be displayed on JSP page.What should be the solution?
    Thanks.

    Hi
    Surely paging would be better solution for same problem. Here I am attaching some sample code. Just edit as per your requirement so go through that
         if(totalPages>10)
              int nextSkip=end>=totalPages ? 0 : end+1;
              int prevSkip=start==1 ? 0 : start-10;
              if(prevSkip!=0)
                   if(js)
                        prevLink="<a href=\""+linkPage+""+prevSkip+")\" class=\"bgWhiteABlacksmallU\"><Previous</a>";
                        firstLink="<a href=\""+linkPage+"1)\""+" class=\"bgWhiteABlacksmallU\"><<</a>";
                   else
                        prevLink="<a href=\"../"+linkPage+"skip="+prevSkip+"\" class=\"bgWhiteABlacksmallU\"><Previous</a>";
                        firstLink="<a href=\"../"+linkPage+"skip=1\" class=\"bgWhiteABlacksmallU\"><<</a>";
              else
                   prevLink="<span class=\"bgWhiteABlack\"><Previous</span>";
                   firstLink="<span class=\"bgWhiteABlack\"><<</span>";
              if(nextSkip!=0)
                   if(js)
                        nextLink="<a href=\""+linkPage+""+nextSkip+")\" class=\"bgWhiteABlacksmallU\">Next></a>";
                        lastLink="<a href=\""+linkPage+"" + totalPages + ")\" class=\"bgWhiteABlacksmallU\">>></a>";
                   else
                        nextLink="<a href=\"../"+linkPage+"skip="+nextSkip+"\" class=\"bgWhiteABlacksmallU\">Next></a>";
                        lastLink="<a href=\"../"+linkPage+"skip="+totalPages+"\" class=\"bgWhiteABlacksmallU\">>></a>";
              else
                   nextLink="<span class=\"bgWhiteABlack\">Next></span>";
                   lastLink="<span class=\"bgWhiteABlack\">>></span>";
         String completeLink=firstLink+"��"+prevLink;
         completeLink=completeLink+"������"+pageLinks;
         completeLink=completeLink+"������"+nextLink;
         completeLink=completeLink+"��"+lastLink;
         //Set the required attributes for the calling page as this page is included using jsp:include action
         request.setAttribute("pageRecords",pageRecords);//helps displaying the records of the current page
         request.setAttribute("pageLinks",pageLinks);//provides links to the other pages
         request.setAttribute("nextLink",nextLink);//provides link to the next 10 pages
         request.setAttribute("prevLink",prevLink);//provides link to the previous 10 pages
         request.setAttribute("firstRecordPosition",new Integer(firstRecordPosition));//gives the position of the first record in the list
         request.setAttribute("lastRecordPosition",new Integer(lastRecordPosition));//gives the position of the last record in the list
         request.setAttribute("recordSize",new Integer(records.size()));//gives the size of the list
         request.setAttribute("currentPage",new Integer(currentPage));//provides the skip parameter
         request.setAttribute("rowSize", new Integer(rowSize));//provides the rowsize value for the subsequent pages
         request.setAttribute("firstLink",firstLink);//provides link to the first page of the list
         request.setAttribute("lastLink",lastLink);//provides link to the last page of the list
         request.setAttribute("completeLink",completeLink);//complete link with first, previous,pageLinks,next and last links
         String recordStatus = "";
         if(recordSize==0){
              recordStatus ="No Records Found";
         }else{
              recordStatus = firstRecordPosition + " to " + lastRecordPosition + " Record(s) of " + recordSize;
         recordStatus= "<span class=\"bgWhiteABlackb\">" + recordStatus +"</span>";
         request.setAttribute("recordStatus", recordStatus);

  • Update/save record on a single page?

    Hi all. I've got a form with read-only fields displaying database data in a repeat region. If I click the Edit button at the end of each line, the 3 fields post to update.php where I can edit the data. The Save button on this page updates the database and returns to the list.  I am new to PHP and was wondering if this can all be done on a single page so all the fields in the repeat region are editable/saveable? thanks guys.

    Unfortunately because form field names need to be unique in case, let's say a user edits 2 different forms, making everything editable live is not usually the best way to go.  Personally, from a beginner's standpoint and from a compatibility standpoint, your way is the best way to go.
    The only other approach would involve javascript and JSON to pass information between PHP and javascript.  Basically the end result would be a Facebook style post system, where what happens in the background is you actually load a processing and/or editing page and then post results back to the original page.  It's a bit complicated for a beginner.  It might not be for you immediately, but it could always be interesting to learn about:
    http://www.99points.info/2010/07/facebook-style-wallpost-and-comments-system-using-jquery- ajax-and-php-reloaded/
    Obviously that is just for a wall, but if you understand how to edit the pages and how the data is moving it could easily fit your needs.

  • What trigger should I use if I want to keep record amendment log?

    I am a newbie to Oracle forms, I would like to raise a simple question here ... hope you won't mind ... I have a form interface which accepts user input to record attributes for an object (e.g. personal information of a user). Now, because the importance of data, I was required to write log records in a journal table for changes made on the data. What trigger am I recommended to place and use?
    Thanks for any replies!

    Duncan, thanks for your reply first. However, I have two queries:
    1) Any generic event state to indicate change of record rather than 'POST-INSERT', 'POST-UPDATE' and 'POST-DELETE'?
    2) Given that I use the 'POST' event, how can I get the pre-update value? (My log record is supposed to record the before-update value)
    Thanks for your reply!

  • To get mutiple records in a single page from oracle datbase to wordpad

    I am writing procedure in oracle to export data into wordpad.
    But each record is printing in seperate pages.
    Also getting error invalid merge fileds... while exporting data.

    hi Zaibi.. thanks for the reply ...
    will tell u my procedure method ,
    assigning variable ,for header ...and opening the text_io.fopen(data_file,'a')
    if this is open than close that and
    opening the text_io.fopen in write mode than put_line ... than wrinting the programming part and finally defining an another variable called record which contain s the data feilds THAN AGAIN PUT LINE THAT RECORD ...
    AFTER THAT
    CALLIN THIS
    IF FileExists(Data_file) THEN
    Word_Obj := OLE2.CREATE_OBJ('Word.Basic');
              word.command(Word_obj, 'AppShow');
              word.command(word_obj, 'AppMaximize', 1);
    word.command(Word_obj, 'FileOpen', Letter_file);
    word.command(Word_obj, 'MailMergeMainDocumentType', 0);
         word.command(Word_obj, 'MailMergeOpenDataSource', Data_file);
         word.command(Word_obj, 'MailMergeEditMainDocument', 0);
         word.command(Word_obj, 'MailMergeToPrinter');
         word.command(Word_obj, 'Fileexit', 2);
              OLE2.RELEASE_OBJ(Word_obj);
         end if;
    BUT STILL GETTING SO MANY PAGES WITH DUMMY VALUES.
    COULD U HELP ME OUT IN THIS ,

  • Delete old records in oracle database using jobs

    Hi,
    will it be possible to delete old records in oracle database using jobs
    need to delete old records on weekly basis and rebuild my index.
    Thanks!

    933633, While it is possible to do a great deal with the dbms_scheduler your shop should have a scheduler like CA Unicenter that is used to run the application job schedules. Purge jobs should probably be part of the normal application schedule rather than contained in the database, if your shop has a scheduler in use.
    As far as rebuilding the indexes after the purge keep in mind that freshly rebuilt indexes often have to split when inserts are performed due to the fact the compacted index blocks do not have room to hold the newly inserted keys in the appropriate locations. So just because you purge weekly does not automatically mean the indexes should be rebuilt weekly. You need to look at the index key DML pattern and at the total percentage of the index that is held by deleted rows.
    HTH -- Mark D Powell --

  • Hi can anyone explain me how to  syncronize two database using jsp?

    Hi can anyone explain me how to syncronize two database using jsp?

    I thinking than you really need the jsp page for calling the java methods whith sincronize the database.You think wrong.
    You wrote a bad question.What was bad about it?
    You need a java method for sincronize the two databases using a jsp page.No you don't, see my answer.

  • Sql database connection in jsp

    Hi,
    I am new to java.
    I know how to connect the database in the java using the javacodings [jdbc] but i am don't know how to connect the database using the jsp.
    Is it easy. If so, can any one help me in this regards.
    Any sample codes or white paper available.
    thanks in advance,
    Regards,
    sa

    Hi,
    Here's a simple application i write to test JSTL.
    Using JSTL is easier.
    Create a directory named tests in your webapps tomcat directoty.
    In this, create a web-inf dir and inside a lib dir.
    Copy JSTL.JAR ans STANDARD.JAR in tests/web-inf/lib/ which are lib for JSTL (found on apache foundation web site, jakarta implementation).
    Copy you jdbc driver in jakarta-tomcat/common/lib dir.
    Here is a file to input some data from an HTML form:
    Create saisie.jsp and record.jsp in you tests apps dir.
    saisie.jsp:
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <html>
    <head>
    <title>Simple Example</title>
    </head>
    <body>
        <h1> Saisie de donn�es  </h1>
        <form name="saisie" action="record.jsp" method="get">
            Code :<input type="text" name="code"/>
            Text :<input type="text" name="text"/>
            <input type="submit" name="submit"/>
        </form>
    </body>
    </html>and record.jsp:
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
    <%@ page isELIgnored ="false" %>
    <html>
    <head>
    <title>Simple Example</title>
    </head>
    <body>
    <sql:query var="result"  maxRows="100">
         select * from ess
    </sql:query>
    <table>
         <!-- Affichage de l'ent�te avec le nom des colonnes -->
         <tr>
         <c:forEach var="name" items="${result.columnNames}">
              <th>${name}</th>
         </c:forEach>
         </tr>
         <!-- Affichage des donn�es avec 'rowsByIndex' -->
         <c:forEach var="ligne" items="${result.rowsByIndex}">
         <tr>
              <c:forEach var="valeur" items="${ligne}">
                   <td>${valeur}</td>
              </c:forEach>
         </tr>
         </c:forEach>
    </table>
    <c:set var="code_id" value="${param.code}"/>
    <sql:update>
        INSERT INTO ESS (ID,TEXT) VALUES (?,?)
        <sql:param>${param.code} </sql:param>
        <sql:param>${param.text}</sql:param>
    </sql:update>
    </body>
    </html>Here's web.xml file to create in tests/web-inf dir:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app
        PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
        "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
        <description>Learning JSTL (or whatever you like</description>
        <context-param>
              <param-name>javax.servlet.jsp.jstl.sql.dataSource</param-name>
              <param-value>jdbc:postgresql://127.0.0.1/gihe,org.postgresql.Driver,gihe,****<param-value>
         </context-param> 
    </web-app>web.xml contains the datasource definition, the jdbc driver, the url, user and password.
    saisie.jsp is a standard html file.
    record.jsp use web.xml datasource to connect to the database and use JSTL tag to insert some data.
    more explanations on java sun site.

  • When and How to close database connection in JSP?

    Hi there,
    I am using MySQL and JDBC 3.0, in my system, When and How to close database connection in JSP?
    Thanks in advance.
    Lonely Wolf
    <%@ page session="true" language="java" %>
    <jsp:include page="checkauthorization.jsp" />
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
    <%--
    Execute query, with wildcard characters added to the
    parameter values used in the search criteria
    --%>
    <sql:query var="availablecomputerList" dataSource="jdbc/Bookingcomputer" scope="request">
    SELECT * FROM computer where status=0
    order by s_code
    </sql:query>
    <html>
    <head>
    <title>Search Result</title>
    </head>
    <body bgcolor="white">
    <center>
    <form action="checkin.jsp" method="post">
    <input type="submit" value="Back to Check-in Page">
    </form>
    <c:choose>
    <c:when test="${availablecomputerList.rowCount == 0}">
    Sorry, no available computer found.
    </c:when>
    <c:otherwise>
    The following available computers were found:
    <table border="1">
    <th>Computer</th>
    <th>Description</th>
    <th>Status</th>
    <c:forEach items="${availablecomputerList.rows}" var="row">
    <tr>
    <td><c:out value="${row.s_code}" /></td>
    <td><c:out value="${row.description}" /></td>
    <td><c:out value="${row.status}" /></td>
    </tr>
    </c:forEach>
    </table>
    </c:otherwise>
    </c:choose>
    </center>
    </body>
    </html>

    when should you close the connection? when you're done with it.
    how should you close the connection? like this: conn.close();
    that said, doing this in a JSP page is bad form and not recommended
    JSP's typically don't contain ANY business or data logic

  • Af:table is not showing records until doing refresh of the view object iter

    Hi Experts,
    I am using JDeveloper 11.1.1.4 and i have a page whhich shows records of a particular read only view object as an af:table. When i run the page at first it is not showing any data at all . But there are 2 records when i run the query of that read only view object.In my page there is a link called "Refresh" which calls the "Execute" operation of the view iterator of my view object. When i click this link the table shows two records.Why the table does not show records once wehn the page is rendered?
    Please help me.

    The following is the code that shows the panel collection in my page.
    <af:panelCollection id="pc1" featuresOff="freeze, wrap"styleClass="NewStyle">
    <f:facet name="secondaryToolbar">
    <af:toolbar id="t1" styleClass="Secondary">
    *<af:query id="qryId1" headerText="Search" disclosed="false"*
    *value="#{bindings.salesInvoiceAuthorisationCriteriaWaitOnlyQuery.queryDescriptor}"*
    *model="#{bindings.salesInvoiceAuthorisationCriteriaWaitOnlyQuery.queryModel}"*
    *queryListener="#{criteria.processQueryForSalesInvoice}"*
    *queryOperationListener="#{bindings.salesInvoiceAuthorisationCriteriaWaitOnlyQuery.processQueryOperation}"*
    *displayMode="compact"*
    *saveQueryMode="readOnly" maxColumns="2"*
    *modeChangeVisible="false" styleClass="Minimal"*
    *conjunctionReadOnly="true"*
    *resultComponentId="::t2"/>*
    </af:toolbar>
    </f:facet>
    <af:table value="#{bindings.salesInvoiceAuthorisation1.collectionModel}"
    var="row"
    rows="#{bindings.salesInvoiceAuthorisation1.rangeSize}"
    emptyText="#{bindings.salesInvoiceAuthorisation1.viewable ? 'No data to display.' : 'Access Denied.'}"
    fetchSize="#{bindings.salesInvoiceAuthorisation1.rangeSize}"
    rowBandingInterval="0"
    filterModel="#{bindings.salesInvoiceAuthorisation1Query.queryDescriptor}"
    queryListener="#{bindings.salesInvoiceAuthorisation1Query.processQuery}"
    filterVisible="true" varStatus="vs"
    selectedRowKeys="#{bindings.salesInvoiceAuthorisation1.collectionModel.selectedRow}"
    selectionListener="#{bindings.salesInvoiceAuthorisation1.collectionModel.makeCurrent}"
    rowSelection="none" id="t2"
    columnStretching="column:accountNameColumn"
    binding="#{processDocuments.invoiceTable}"
    contentDelivery="immediate"
    partialTriggers="::c111 selectToPost ::qryId1"
    styleClass="newTableStyle" autoHeightRows="9">
    <af:column filterable="false" sortable="false"
    headerText="#{bindings.DocumentAuthorisationView1.hints.ToPost.label}"
    id="c18" align="center"
    styleClass="#{row.bindings.ToPost.inputValue ? 'RowSelected' : ''}"
    width="103">
    <af:selectBooleanCheckbox id="selectToPost"
    value="#{row.bindings.ToPost.inputValue}"
    autoSubmit="true"/>
    </af:column>
    <af:column sortProperty="DocumentName" filterable="true"
    sortable="true"
    headerText="#{bindings.salesInvoiceAuthorisation1.hints.DocumentName.label}"
    id="c11"
    styleClass="#{row.bindings.ToPost.inputValue ? 'RowSelected' : ''}"
    width="107" filterFeatures="caseInsensitive">
    <af:outputText value="#{row.DocumentName}" id="ot1"/>
    </af:column>
    <af:column sortProperty="ExternalReference" filterable="true"
    sortable="true"
    headerText="#{bindings.salesInvoiceAuthorisation1.hints.ExternalReference.label}"
    id="c10"
    styleClass="#{row.bindings.ToPost.inputValue ? 'RowSelected' : ''}"
    width="105" filterFeatures="caseInsensitive">
    <af:outputText value="#{row.ExternalReference}" id="ot8"/>
    </af:column>
    <af:column sortProperty="DocumentCategory" filterable="true"
    sortable="true"
    headerText="#{bindings.salesInvoiceAuthorisation1.hints.DocumentCategory.label}"
    id="c9"
    styleClass="#{row.bindings.ToPost.inputValue ? 'RowSelected' : ''}"
    width="105" filterFeatures="caseInsensitive">
    <af:outputText value="#{row.DocumentCategory}" id="ot11"/>
    </af:column>
    <af:column sortProperty="CrDr" filterable="true"
    sortable="true"
    headerText="#{bindings.salesInvoiceAuthorisation1.hints.CrDr.label}"
    id="c4"
    styleClass="#{row.bindings.ToPost.inputValue ? 'RowSelected' : ''}"
    width="52" align="right">
    <af:outputText value="#{row.CrDr}" id="ot9">
    <af:convertNumber groupingUsed="false"
    pattern="#{bindings.salesInvoiceAuthorisation1.hints.CrDr.format}"/>
    </af:outputText>
    </af:column>
    <af:column sortProperty="BaseDate" filterable="true"
    sortable="true"
    headerText="#{bindings.salesInvoiceAuthorisation1.hints.BaseDate.label}"
    id="c8"
    styleClass="#{row.bindings.ToPost.inputValue ? 'RowSelected' : ''}">
    <f:facet name="filter">
    <af:inputDate value="#{vs.filterCriteria.BaseDate}"
    id="id1" contentStyle="text-transform:uppercase;">
    <af:convertDateTime pattern="#{bindings.salesInvoiceAuthorisation1.hints.BaseDate.format}"/>
    </af:inputDate>
    </f:facet>
    <af:inputDate value="#{row.BaseDate}" id="ot6" contentStyle="text-transform:uppercase;">
    <af:convertDateTime pattern="#{bindings.salesInvoiceAuthorisation1.hints.BaseDate.format}"/>
    </af:inputDate>
    </af:column>
    <af:column sortProperty="ExternalAccountCode"
    filterable="true" sortable="true"
    headerText="#{bindings.salesInvoiceAuthorisation1.hints.ExternalAccountCode.label}"
    id="c6"
    styleClass="#{row.bindings.ToPost.inputValue ? 'RowSelected' : ''}"
    filterFeatures="caseInsensitive" visible="false">
    <af:outputText value="#{row.ExternalAccountCode}" id="ot3"/>
    </af:column>
    <af:column sortProperty="AccountName" filterable="true"
    sortable="true"
    headerText="#{bindings.salesInvoiceAuthorisation1.hints.AccountName.label}"
    id="accountNameColumn"
    styleClass="#{row.bindings.ToPost.inputValue ? 'RowSelected' : ''}"
    filterFeatures="caseInsensitive">
    <af:outputText value="#{row.AccountName}" id="ot4"/>
    </af:column>
    </af:table>
    </af:panelCollection>
    Edited by: Priya on Nov 22, 2011 12:22 AM

  • Safari won't open pictures on imgur. To test used another browser and it showed them

    Safari won't open pictures on imgur. To test used another browser and it showed them
    Here is the page was trying to surf  http://imgur.com/gallery/n9Bjm

    From the Safari menu bar, select
    Safari ▹ Preferences... ▹ Extensions
    Turn all extensions OFF and test. If the problem is resolved, turn extensions back ON and then disable them one or a few at a time until you find the culprit.

  • Report -- filter with selection list -- show all values after select page

    Hello!
    I have the following problem:
    - I have a report
    - this report can be filtered with a selection-list
    - the selection list is based on dynamic LOV and has a null-value
    - I added the code of the report the following, to filter the report after choosing a value of the selection list:
    ... and (instr(type, decode(:P8_FILTER_type, '%null%',type,:P8_FILTER_type)) > 0)
    This works very well.
    But my problem is: When the user logs out and the next time, he logs in, the selection list shows " --- show all values --- " (my null-display-value) and the report is empty "no values found".
    ---> I want to show the first time, the page is selected ALL the values of the report. (this is now only possile if I press the button which belongs to the selection list)
    I hope, somebody understands my problem.
    Thank you so much,
    LISA

    Hello Lisa,
    The first time it's probably NULL.
    So what you can do in your where: (instr(type, decode(NVL(:P8_FILTER_type,'%null%'), '%null%',type,:P8_FILTER_type)) > 0)
    Off topic: I also wonder if that where clause can't be simpler? Do you rely need the instr?
    Regards,
    Dimitri
    http://dgielis.blogspot.com/
    http://www.apex-evangelists.com/
    http://www.apexblogs.info/

  • How to show excessive values in next page in SAP SCRIPT

    Hello,
    Please any one can help to show excessive values in next page .
    For example i want to show
    567
    5678
    789
    23456
    I want to show values 23456 in next page only.
    Can anyone please suggest me how to do so?
    Thanks and regards
    Mave

    Hi Swetlin,
    I have this format in the main window.
    textaaaaaaaaaaaaaaaaa
    textfffffffffffffff
    123
    1234
    1234
    5667
    1234
    textweeeeeeeeeeeeeeeeeeeeee
    texttryrtyrtuyrturtur
    now when i am doing as you suggested
    the last texts are coming in the next page.
    What i want is to show overflow of numeric data in next page and the remaining last text should remain as it is in the first page only.
    i mean
    textaaaaaaaaaaaaaaaaa
    textfffffffffffffff
    123
    1234
    1234
    5667
    1234
    textweeeeeeeeeeeeeeeeeeeeee
    texttryrtyrtuyrturtur
    and in the next page
    4567
    4568
    8790
    Thanks and regards
    Mave

  • How to get first 10 records from the database using JSP

    i want ot get first 10 records from the database and then after clicking the next button in the page,it must show the next precceding 10 records from the database.i am getting the first 10 records .but how to post to the same page to get another preceeding 10 record.

    Search the forums - this has been asked a lot. I usually recommend experimenting with tops and order bys until you're satisfied.
    Kind regards,
      Levi

  • How to store files in mysql database using JSP?

    I'm developing an online recruitment system using JSP in server side. For the users who registers in it, I want them to upload their cv's from the web site so that I can store it in the database..I'm using mysql as the db..
    Can I know how to do it.?..or else is there any better way of doing that?
    Need a quick reply..Tx

    The best way to put data in a database in a JSP is to not do it. Instead, use a Servlet that calls a DataAccessObject. The DAO puts the data in the DB and the servlet gives the data to the DAO. The JSP does nothing but display results.
    Take a google for JSP MVC and DAO. BalusC has a great example of DAO and a JSP that uses one on his blog.

Maybe you are looking for