1

私はコントローラーとgspを持っています。先に進んでプロジェクトをビルドしようとしましたが、gspで問題が発生しました。

「現在のスコープにはすでにitという名前の変数が含まれています」と表示されます

<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>

そのように「それ」を使用することは許可されていませんか?それとも私が行方不明になっている明らかな何かがありますか?

4

1 に答える 1

2

http://www.grails.org/Views+and+Layouts

<html>
<head>
    <title>Book list</title>
</head>
<body>
<h1>Book list</h1>
<table>
    <tr>
        <th>Title</th>
         <th>Author</th>
    </tr>
    <g:each in="${books}">
        <tr>
             <td>${it.title}</td>
             <td>${it.author}</td>
        </tr>
    </g:each>
</table>
</body>
</html>
于 2010-09-07T23:47:19.683 に答える