Note that there are some explanatory texts on larger screens.

plurals
  1. POrequest variables in grails
    text
    copied!<p><strong>EDIT</strong>: based on feedback, erased original Q. completely and reposting in better language</p> <p>I wish to access a request or params variable and pass it between the controller and the gsp. i understand that the params object contains everything that a querystring has.</p> <p>All the examples I see are all Model driven. I have looked up docs online and I have two books - beginning-grails and definitive guide to grails, both have database driven examples on params. I want to understand how params can be set and accessed. All I read everywhere is that it is a map of request variables.</p> <p>My scenario is as follows: I have a controller which sends a list (not from a database) to the GSP. I thought of passing a "params" variable between GSP and the controller.</p> <p>To reiterate, the scenario I have is not a Model driven one. I am looking to iterate thru a list of items (with no database count known) and is driven by user click. I thought of implementing something like what twitter has "the-more-button-on-the-bottom". have a simple remotelink at the bottom of the page with a new page counter, which i access in the controller and pass to my service class for the new part of list.</p> <p>controller code:</p> <pre><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 </code></pre> <p>GSP (not actual) code</p> <pre><code> &lt;%= params.get("pagecount") %&gt; &lt;%= nxtPage = pagecount++ %&gt; ... &lt;%params["myId"] = nxtPage%&gt; &lt;g:remoteLink action="list" id="${nxtPage}"&gt;More&lt;/g:remoteLink&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload