Struts 1操纵索引的值

时间:2018-02-21 11:52:33

标签: loops struts jsp-tags

我使用struts1。 我有一个列表(searchList)在jsp中显示 这个列表有30行

我想在3个表格中显示它。 主要讲第一桌上的前10项,依此类推

使用<logic:iterate>时我想访问index的值,只需在下一个表上添加+ 10,在下一个表上再添加10。 我不知道该怎么做

我的代码就像

<logic:iterate id="list" name="formName" property="searchList" indexId="i">
<bean:write name="formName" property='<%="list["+ (i.intValue() + 10) + "]"%>' />
</logic:iterate>

但这样做只是连接索引和&#34; 10&#34;。 请helpppp。

1 个答案:

答案 0 :(得分:0)

尝试使用offset标记中的length<logic:iterate>属性。例如,

第二桌:

<logic:iterate id="list" name="formName" property="searchList" indexId="i" offset="10" length="10">

第3桌:

<logic:iterate id="list" name="formName" property="searchList" indexId="i" offset="20" length="10">