当前位置: 代码迷 >> Java Web开发 >> 关于 JSTL 的有关问题 大家HELP
  详细解决方案

关于 JSTL 的有关问题 大家HELP

热度:673   发布时间:2016-04-17 13:06:34.0
关于 JSTL 的问题 大家HELP
<c:forEach   var= "i "   begin= "1 "   end= "5 ">
<td>
      <table>
              <c:forEach   var= "n "   items= "${news+ 'i '} "   >    
                      <tr>  
                      <td>
                        <c:out   value= "${n.titlename} "   />
                    </td>
                    </tr>
              </c:forEach>
              </table>
  </td>
  </c:forEach>
news0   ~news5   都是Vector       想整洁所   想用FOREACH  
为什么   "${news+ 'i '} "   会错啊?   应该怎么写呢?  
先谢了

------解决方案--------------------
你这不错才怪,你应该把news0-news5都压入一个集合容器里,比如List,Set等
然后用两个foreach
------解决方案--------------------
<c:forEach var= "l " items= "${list} ">
<td>
<table>
<c:forEach var= "n " items= "${l} " >
<tr>
<td> ${n.titlename} </td>
</tr>
</c:forEach>
</table>
</td>
</c:forEach>