<c:set var="educationLevelID" value="${educationLevel.id}"/><c:forEach items="${educationLevelID}" var="enrollExamCourse">
      <option value="${enrollExamCourse.id}">${enrollExamCourse.courseName}</option>
</c:forEach> 这样写只能获取educationLevelID的值,无法获得List。如果我把educationLevelID换成它的值就没问题了,就可以获取List了。这个问题也可以归结为这样:EL里没有这样的语法 ${${educationLevel.id}},那么这样的问题该怎么处理呢?

解决方案 »

  1.   

    完整代码是这样的:<c:forEach items="${educationLevelList}" var="educationLevel">   
                <tr>   
                    <td>  
                    ${educationLevel.educationLevelName} 
                    </td>
                    <td>  
                    <input type="text" name="totalScore">
                    </td>      
                    <td>
                    <c:set var="educationLevelID" value="${educationLevel.id}"/>
                     <select name="singleScore">
                       <option selected="selected" value="">请选择</option>
                       <c:forEach items="${educationLevelID}" var="enrollExamCourse">
           <option value="${enrollExamCourse.id}">${enrollExamCourse.courseName}</option>
           </c:forEach> 
                     </select>
                    </td>
                    <td>  
                    <input type="text" name="singleScore">
                    </td> 
                </tr>   
            </c:forEach>   
      

  2.   

    楼主你可以在后台事先将educationLevel.id值,然后根据这个值得到的list放到educationLevel的一个属性中去例如放到idlist这个属性中,然后前台就可以用
     <c:forEach items="${educationLevel.idlist}" var="enrollExamCourse">
                                  <option value="${enrollExamCourse.id}">${enrollExamCourse.courseName}</option>
                              </c:forEach> 
    也就是在后台做下处理前台不要过多的业务逻辑处理,
      

  3.   

    也就是在后台将的需要通过educationLevel.id的值得到list的事交给后台处理好了返回给前台