0
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をレンダリングして正しく動作します。UrlMappingメソッドがデフォルト以外のビューをレンダリングしないようにする
myapp.com/search/list?searchPhrase=underware
2)このURLは/ビュー/検索/リストをレンダリング、仕事をしていません。
myapp.com/search?searchPhrase=underware
任意のアイデア?
私は混乱しています。 URL 1は、 'search'コントローラの' list'アクションを正しく行っています。しかし、URL 2の問題は何ですか?それは何ですか?あなたはそれが何をすると思いますか? – cdeszaq