How can I make two urls maps to one controller?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How can I make two urls maps to one controller?

xunitc
Hi.

My UrlMappings.groovy has this:

"/book-list/$offset-$max/"(controller: "book", action: "list") {
        constraints {
                offset(matches: /\d+/)
                max(matches: /\d+/)
        }
}
"/book-list/"(controller: "book", action: "list")

It can work with grails 2.2, but can not work with grails 2.3.
Grails 2.3 give me this error:
Unable to create URL for mapping [/book-list/(*)-(*)/] and parameters [{controller=book, action=list}]. Parameter [max] is required, but was not specified!

How can I make it work please?
Xunitc
Reply | Threaded
Open this post in threaded view
|

Re: How can I make two urls maps to one controller?

droggo
this may not help a lot, but fresh app, with BookController with list() method and your two URL Mappings + default ones works ok.

droggo
Reply | Threaded
Open this post in threaded view
|

Re: How can I make two urls maps to one controller?

xunitc
Hi.

I try a new app with grails 2.3, but I still got this error.
I put only one method named 'list' in BookController,
and two maps in UrlMappings.groovy like my topic say.
The url-maps can works good in grails 2.2.
So what is my wrong in grails 2.3 please?

The attache is my app.

cup.zip
Xunitc
Reply | Threaded
Open this post in threaded view
|

RE: How can I make two urls maps to one controller?

droggo

Your app is working on my side in 2.3.0

Did you try “grails clean” or cleaning .grails dir?

 

droggo

Reply | Threaded
Open this post in threaded view
|

RE: How can I make two urls maps to one controller?

xunitc
Hi.
Thanks for you, droggo.

I run grails clean, but still got this error.
I change to another computer, got this error too.
Now I try to change one of the action name and the url-maps, I think I
am a little stupid. :(

2013/9/16 droggo <[hidden email]>:

> Your app is working on my side in 2.3.0
>
> Did you try “grails clean” or cleaning .grails dir?
>
>
>
> droggo
>
>
> ________________________________
> View this message in context: RE: How can I make two urls maps to one
> controller?
>
> Sent from the Grails - user mailing list archive at Nabble.com.



--
Xunitc.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Xunitc
Reply | Threaded
Open this post in threaded view
|

RE: How can I make two urls maps to one controller?

droggo

In our application we are mostly using named url mappings, maybe this will help with your problem: http://grails.org/doc/latest/guide/single.html#namedMappings

If not, I’m not able to help, sorry

 

droggo