Displaying 10 records per page using jsp

Discussions

Web tier: servlets, JSP, Web frameworks: Displaying 10 records per page using jsp

  1. Displaying 10 records per page using jsp (4 messages)

    HI ALL,
    I have a problem in JSP.

    I want to display 10 records per page.If i click on next button it shld display next 10 records.Similarly for previous button.

    I don't want to use TAG library (Pager...)
    Plzzz tell me other than this....
  2. But why not use a tag library?[ Go to top ]

    I just have to ask because I can't imagine a reason for not using a tag library like displaytag or valuelist for this type of problem, because my answer would be to replicate the code in one of those projects for your solution -;)

    Kris Thompson
  3. Some of the MVC based frameworks implement this range paging pattern. One of the framework that does this is ADF. In case you are interested to use a framework, you can check out ADF.
    http://www.oracle.com/technology/products/jdev/collateral/papers/10g/ADF_overview.pdf
  4. Hallo

    If you have make a searchresult bean something like

    public SearchResultBean {
       private SearchData[] searchData;
       private int index = 0;
       /**
       ** Count the index back x position
       */
       public void previous();
       /**
       ** Count the index forward x position
       */
       public void next();
       /**
       *

       public Collection getData();

    }
  5. .. was not complete

    If you have make a searchresult bean something like

    public SearchResultBean {
       private SearchData[] searchData;
       private int index = 0;
       /**
       ** Count the index back x position
       */
       public void previous();
       /**
       ** Count the index forward x position
       */
       public void next();
       /**
       * Return the SearchData from index and x position forward
       */
       public Collection getData();

    }

    And in the JSP your just iterate on over the SearchResultBean.getData() collection

    adding two buttons forward and back, and remember to store you bean in session.

    Hope this helps!

    /Per