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)此网址无法正常工作,无法呈现/ views / search / list。
myapp.com/search?searchPhrase=underware
有任何想法吗?
最佳答案
您可能想在搜索URL映射中将“ View ”替换为“操作”。
关于grails - UrlMapping导致方法不呈现与默认 View 不同的 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8826211/