Results 1 to 5 of 5

Thread: Move the Record - MoveFirst, MoveLast, MoveNext, MovePreviou

  1. #1
    Join Date
    May 2005
    Location
    Chennai, India
    Posts
    4

    Default Move the Record - MoveFirst, MoveLast, MoveNext, MovePreviou

    Hello Everyone,

    I am having 10 records in a table.
    I want to get the record, when I click the buttons like MoveFirst, MoveLast, MoveNext and MovePrevious.

    How can I do this using Spring Framework?

    I am trying to do this without adding the scriptlets to the resultant JSP.

    Thanks in advance.

    -S.Yogesh
    Reflections never lie.

  2. #2
    Join Date
    Aug 2004
    Location
    Germany, Magdeburg
    Posts
    279

    Default

    Hi syogesh,

    What exactly are you trying to do? Do you want to navigate those records by hitting next and previous buttons or do you want to change the position of each record within the table?


    Cheers,

    Martin

  3. #3
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    If you want pagination you can find some examples and discussions on this topic in the Hibernate wiki: http://www.hibernate.org/243.html
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  4. #4
    Join Date
    May 2005
    Location
    Chennai, India
    Posts
    4

    Default

    Hi Martin,

    I am trying to navigate the records by hitting the "Move Next", "Move Previous", "Move First" and "Move Last" buttons.

    Then, the data will be displayed in the Text Box, corresponding to the button I hit.

    Thanks for your reply.

    Regards,
    -S.Yogesh
    Reflections never lie.

  5. #5
    Join Date
    Aug 2004
    Location
    Germany, Magdeburg
    Posts
    279

    Default

    I am trying to navigate the records by hitting the "Move Next", "Move Previous", "Move First" and "Move Last" buttons.

    Then, the data will be displayed in the Text Box, corresponding to the button I hit.
    So to paint a picture about it, you have a single page view and all your records in your tables represent pages in a book. When you hit the next page button you want to show the next page etc.

    That makes sense to me. I think, a good way to implement this might be looking into Spring's WebFlow sub-project. http://opensource.atlassian.com/conf...y/WEBFLOW/Home

    But in the end, all you need is maintaining the number of the next and previous 'page/record' to show when the button is pressed (dynamic link might do it: showPage.html?page=${currentPage + 1}).

    And also you need an ordering for the records. Normally a database relation is a union and not a list. One idea might be using 'oder by' in either SQL or Hibernate to achieve it.

    Since you are likely to fetch just a single row (or object), using pagination or a little session scoped cache might do the trick.


    Cheers,

    Martin (Kersten)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •