Jquery ThymileAF页有2个对象出错

Jquery ThymileAF页有2个对象出错,jquery,html,scala,thymeleaf,Jquery,Html,Scala,Thymeleaf,Thymeleaf formth:object和th:each对象在此使用,它是控制器 <form action="#" th:action="@{/saveStudenttest.html}" th:object="test"> //here shown the runtime error <table class="table" align="center"> <tr> <th

Thymeleaf formth:objectth:each对象在此使用,它是控制器

<form action="#" th:action="@{/saveStudenttest.html}" th:object="test"> //here shown the runtime error 
        <table class="table" align="center">
            <tr>
                <th>Student</th>
                <th>Test Name</th>
                <th>Correct</th>
                <th>Wrong</th>
                <th>Not-Attended</th>
                <th>Grade</th>
            </tr>
            <tr th:each=" tr : ${testResult}">
                <td th:text="${tr.student.name}">NiL</td>
                <td th:text="${tr.test.testName}" >NiL</td>
                <td th:text="${tr.correct}">NiL</td>
                <td th:text="${tr.wrong}" >NiL</td>
                <td th:text="${tr.notAttend}">NiL</td>

            <td><select >//this is the listbox but the values in list box is not get
            <option value="" th:value="${'Excellent'}"  >Excellent</option>
            <option value="" th:value="${'Very Good'}" >Very Good</option>
            <option value="" th:value="${'Good'}" >Good</option>
            <option value="" th:value="${'Need To Improve'}" >Need To Improve</option>
 </select></td>

 <td><input type="submit" class="btn btn-primary" value="Update"  name="update"  />
 <input type="hidden"   name="id"  th:field="*{id}"/> </td>
</tr>
</table>
 </form>
但是发生了运行时错误。我想这是因为这里使用了2个对象。一个是th:objectth:each对象

但是我想列出所有项目,同时更新等级保存更新

<form action="#" th:action="@{/saveStudenttest.html}" th:object="test"> //here shown the runtime error 
        <table class="table" align="center">
            <tr>
                <th>Student</th>
                <th>Test Name</th>
                <th>Correct</th>
                <th>Wrong</th>
                <th>Not-Attended</th>
                <th>Grade</th>
            </tr>
            <tr th:each=" tr : ${testResult}">
                <td th:text="${tr.student.name}">NiL</td>
                <td th:text="${tr.test.testName}" >NiL</td>
                <td th:text="${tr.correct}">NiL</td>
                <td th:text="${tr.wrong}" >NiL</td>
                <td th:text="${tr.notAttend}">NiL</td>

            <td><select >//this is the listbox but the values in list box is not get
            <option value="" th:value="${'Excellent'}"  >Excellent</option>
            <option value="" th:value="${'Very Good'}" >Very Good</option>
            <option value="" th:value="${'Good'}" >Good</option>
            <option value="" th:value="${'Need To Improve'}" >Need To Improve</option>
 </select></td>

 <td><input type="submit" class="btn btn-primary" value="Update"  name="update"  />
 <input type="hidden"   name="id"  th:field="*{id}"/> </td>
</tr>
</table>
 </form>
这就是图像

按下更新按钮时,列表框项目将保存在字段等级

现在页面未正确运行显示运行时错误

错误:


无法解析为表达式:“test”

请尝试此表达式。。此处,select的值传递给控制器

 <form action="#" th:action="@{/saveStudenttest.html}" > 
        <table class="table" align="center">
            <tr>
                    <th>Student</th>
                <th>Test Name</th>
                <th>Correct</th>
                <th>Wrong</th>
                <th>Not-Attended</th>
                <th>Assign Grade</th>
                <!-- <th>Max-Mark</th> -->
            </tr>
            <tr th:each=" tr : ${testResult}">
            <td th:text="${tr.student.name}">NiL</td>
            <td th:text="${tr.test.testName}" >NiL</td>
            <td th:text="${tr.correct}">NiL</td>
            <td th:text="${tr.wrong}" >NiL</td>
            <td th:text="${tr.notAttend}">NiL</td>

            <td><select name ="combo">
                    <option value="Excellent" th:value="${'Excellent'}">Excellent</option>
            <option value="Very Good" th:value="${'Very Good'}" >Very Good</option>
            <option value="Good" th:value="${'Good'}" >Good</option>
            <option value="Need to Improove" th:value="${'Need To Improve'}">Need To Improve</option>
            </select></td>
        <td><input type="submit" class="btn btn-primary" value="Update"  name="update"  />
        <input type="hidden"   name="id" th:value="${tr.id}" /></td>
        </tr>
    </table>
 </form>  
@RequestMapping(value = Array("parent/result.html"))
  def result(testModel: ModelMap): String = {
    println(results)
    testModel.addAttribute("testResult", results)
    "parent/test-result"
  }

@RequestMapping(value = Array("parent/ViewReport.html"))
  def viewAssessment(stmodel:ModelMap ): String = {
      stmodel.addAttribute("test", results)       
    "parent/assessment-report"
  }

@RequestMapping(value = Array("/saveStudenttest.html"), params = Array({ "update" }), method = Array(RequestMethod.GET))
  def afterUpdateStudenttest(test: StudentTest,@RequestParam id: Long,combo:String): String = {
        var tId:StudentTest=studentTestService.findStudentTestById(id)
    println(tId+"#####################"+combo)
    tId.setGrade(combo)
    studentTestService.saveOrUpadeStudentTest(tId)
    "redirect:/parent/ViewReport.html"
  }