0
我有一個Grails應用,在那裏urlMappings.groovy
文件的內容是:Grails的urlMappings動作和控制器行爲不使用控制器邏輯
"/" {
controller="home"
view="home"
}
我家的控制器看起來像
class HomeController {
List products = [
['price': 100, 'desc':'a'],
['price': 200, 'desc':'b']
]
def home() {
[products: products]
}
當我瀏覽到localhost:8080/myProject/home/home
,我有權訪問"${products}"
,但是當我導航到localhost:8080/myProject
時,"${products}"
語句爲空。
爲什麼會這樣,我怎樣才能使localhost:8080/myProject
的行爲與localhost:8080/myProject/home/home
一樣?
Woops!如果認爲名稱不是行動,那是什麼造成的。 – 2014-10-18 11:56:19