views:

21

answers:

1

I want to separate String params with a "-" in a url.

I had configurate UrlMappings with:

name friendlyurl: "/${productId}-${title}_url"{
  controller = "product"
  action = "index"
}

The productId is in the form stringnumber, like ESE123

The product controller needs the param productId. It works with url like:

ESE1234-asdlashdlasj_url

But not with

ESE1234-Adidas-shoes_url

In the last case it take ESE1234-Adidas as a productId.

Maybe grails is using eager regexp matcher.

How to I disable this eager regexp in order to only take to the first "-"? Or maybe other way maybe.

+1  A: 

why dont you just do

name friendlyurl: "/${productId}/${title}_url"{
  controller = "product"
  action = "index"
}

and if the "-" is so important, just concat it back together in the controller

Aaron Saunders
In the url is important the "-"
damian
take a look at this, you might have problems with your approach http://jira.codehaus.org/browse/GRAILS-3202
Aaron Saunders