How do I get the index location in DisplayTag lib ?
I’ve been trying the following but appreantly it’s not right:
<display:table name="${actionBean.templateItems}" id="templateItems" defaultsort="">
<display:column title="Product" property="name"/>
<stripes:hidden name="templateItems[%{#attr.row_rowNum - 1}].id" value="${templateItems.id}"/>
</display:table>
displaytag uses the id attribute of the table tag, and appends “_rowNum” to this attribute, to define another attribute containing the current row number.
So, the attribute, in your case, is named
templateItems_rowNum. And as any page scope attribute, you access it using${templateItems_rowNum}:You shouldn’t use a plural form (
templateItems) to refer to a single object. It makes things very confusing. The current element should thus be namedtemplateItem.