开发者

Grails UrlMappings with "-" as a separator

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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜