class SearchController {
def list = {
List<Product> productsList = productRepository.findProductBySearchPhrase(params.searchPhrase)
render(view: "/product/list", model: [products: productsList])
}
}
class UrlMappings {
"/$controller/$action?/$id?" {
constraints {}
}
"/search" {
controller = "search"
view = "list"
constraints {}
}
}
1) 此 URL 正常工作,从 /views/product/list 目录呈现 GSP。
myapp.com/search/list?searchPhrase=underware
2) 这个 URL 不起作用,渲染 /views/search/list。
myapp.com/search?searchPhrase=underware
有任何想法吗?