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
有什么想法吗?
答案 0 :(得分:2)
可能是您要更换&#39;查看&#39;用&#39;动作&#39;在搜索网址映射中。