日期:2014-05-18  浏览次数:20661 次

问个外行的问题<bean:write name="index"/>索引能从1开始嘛?
<logic:iterate   id= "var "   name= "doc "   indexId= "index ">        
        <bean:write   name= "index "/>
        <bean:write   name= "var "/> <br>
        </logic:iterate>

序号从0开始,有办法从1开始不?解决立即给分

------解决方案--------------------
帮顶。。。
------解决方案--------------------
<logic:iterate id= "var " name= "doc " indexId= "index " offset= "1 " >
<bean:write name= "index "/>
<bean:write name= "var "/> <br/>
</logic:iterate>
offset为1表示将从doc集合中的第二个元素开始遍历.
------解决方案--------------------
ding
------解决方案--------------------
<logic:iterate id= "var " name= "doc " indexId= "index ">
<%=index + 1%>
<bean:write name= "var "/> <br/>
</logic:iterate>

或者用jstl

<logic:iterate id= "var " name= "doc " indexId= "index ">
<c:out value= "${index + 1} " />
<bean:write name= "var "/> <br/>
</logic:iterate>