Request variables in grails

EDIT : based on the feedback, the original Q is erased completely and redistributed in the best language

I want to access the request or params variable and pass it between the controller and gsp. I understand that the params object contains everything that has a querystring.

All the examples that I see, all models are managed. I searched the documents on the Internet and I have two books - the initial grails and the final grails manual, both have examples with parameter databases. I want to understand how to set and get parameters. All I read throughout is that it is a map of query variables.

My scenario is as follows: I have a controller that sends a list (not from the database) to the GSP. I was thinking of passing the variable "params" between the GSP and the controller.

I repeat, the scenario that I have is not a model one. I am looking for iteration through a list of elements (without counting the database) and is controlled by a user click. I was thinking about implementing something like Twitter has more-button-on-bottom. have a simple remotelink at the bottom of the page with the new page counter that I get in the controller and go to my class of service for the new part of the list.

controller code:

//access params from request
int pageInt =params["pagecount"] // *i always get null here*

callMyList(pagecount) //calls my service method to get next set of list for next page

GSP code (not current)

 <%= params.get("pagecount") %>
 <%= nxtPage = pagecount++ %>
  ...
 <%params["myId"] = nxtPage%>


<g:remoteLink action="list" id="${nxtPage}">More</g:remoteLink>
+1
source share
2 answers

params . GSP . - , . GSP , . , , "". , remoteLink, nxtPage params.id List, . params.pagecount, params remoteLink. - :

<g:remoteLink action="list" params="[pagecount: nxtPage]">More</g:remoteLink>
+2
def urlString =  request.scheme + "://" + request.serverName + ":" 
+ request.serverPort + "/" + grailsApplication.metadata.'app.name' 
+ "/" + controllerName + "/" 
+1

All Articles