grailsgsp

What would be the best way to store a list in a GSP page


I currently have a gsp page with pagination and bulk actions based off of checkboxes. I want to store the checked item ids as the user goes to the next page, but to do so I need to store the items the user has checked. I was wondering how I could store that in the GSP page?

Thank you.


Solution

  • I want to store the checked item ids as the user goes to the next page, but to do so I need to store the items the user has checked. I was wondering how I could store that in the GSP page?

    You could store them in a GSP page simply by defining a variable in the page and assigning it a value of the ids, but that won't solve the problem you are trying to solve because that page will be gone by the time the user navigates to the next page.

    Unless you are introducing some client side technology for managing state, a more common thing to do would be to submit the ids to the server and store them in a session or possibly in a database depending on the use case.