我有一個控制器和一個gsp。我繼續嘗試構建項目,但在我的gsp上收到問題。Grails自定義服務器頁面(自定義gsp)
它告訴我,「目前的範圍已經包含它的名稱的變量」
<html>
<head>
<title>Book Collector</title>
<meta name="layout" content="main" />
</head>
<body>
<h1>Book Editor</h1>
<table>
<tr>
<th>Book Name</th>
<th>Author</th>
<th>Page Number</th>
<th>Vendor</th>
<th>Date Scanned</th>
<th>Date Read</th>
</tr>
<% bookList.each { it -> %>
<tr>
<td><%= it.bookName %></td> //this is where the error starts
<td><%= it.author %></td> //error (it)
<td><%= it.pageNumber %></td> //error (it)
<td><%= it.lastScan %></td> //error (it)
<td><%= it.lastRead %></td> //error (it)
<% } %>
</tr>
</table>
</body>
</html>
不允許我用「它」這樣呢?還是有什麼明顯的我失蹤了?
因爲你是剛剛開始,我會建議開始www.grails.org – 2010-09-07 23:48:04
但你說得對。你不能用「它 - >」,但如果你省略'它 - >'我相信它會起作用 - 但它並不是真正的Groovy/Grails做法! – sbglasius 2010-09-08 09:54:28