HTTP Status 404 rest url mapping error pagination next

280 views Asked by At

I have a list.gsp that displays list of items which is restful. It displays well but It gives me error when I click next or page no. My mapping is:

"/request/list/$sort?/$order?/$max?/$offset?"(controller:"request"){
            action = [GET:"list"]
           }

My view pagination is:

   <div class="paginationlayer">
        <span >
         <g:paginate next="Next" prev="Back"

              total="${ total }" /></span>

      </div>

I tried using name url mapping like this:

   name requestURL: "/list/$sort?/$order?/$max?/$offset?"{
            controller = 'request'
            action = 'list'
        }

and out some mapping in the view like this mapping="requestURL", I even added params in the pagination, or hardcoded params like offset, max etc but still the same.

but still it gives me HTTP Status 404 when I click "next" it seems that the url loses its map and becomes something like this : http://localhost:8081/client/request/%5BGET%3Alist%5D?offset=10&max=10&order=desc

2

There are 2 answers

1
Gregor Petrin On

There is no need to list all possible parameters in UrlMappings.groovy: whatever you may need will still be available via the params object or via action method attributes.

Please try rewriting the url mapping as

"/request/list"(controller:"request"){
        action = [GET:"list"]
}

This will probably resolve your issue and save us the (possibly considerable) effort of determining why exactly your URL mapping isn't being accepted.

0
user742102 On

as basic as it may sound, the solution was to put action="list" to the pagination. Didn't occur to me coz all my paginations work with out it.

 <span class="gadgetNumber">
         <g:paginate next="Next" prev="Back"
        maxsteps="0" action="list"    
              total="${ printRequestInstanceTotal }" /></span>