Struts <logic:iterate> Tag & the indexId property

M

mikelsmith

Hello all, I could use some help with the "indexId" property that is
associated with the Struts <logic:iterate> tag. I am using the iterate
tag as follows:

<logic:iterate id="someId" name="someName" property="someCollection"
indexId="idx" type="java.lang.String" >

I am iterating this collection to dynamically create the correct number
of text fields on my JSP. I need to write out the current text field
line number (which I need to get from idx). My problem is that the
<logic:iterate> tag starts at zero (0) instead of one (1). I need to
increment this variable before writing it out. How do I do this??

I've tried: <%=idx+1%> but this does not work because idx is of type
Integer, not int.

Thanks in advance.
 
W

Wendy S

I've tried: <%=idx+1%> but this does not work because idx is of type
Integer, not int.

If idx is of type Integer, can't you call its methods?
<%= idx.intValue() + 1 %>
 
T

TheVooDooChild

Thanks Wendy... I think i'm losing my mind cuz I swear that I tried
that awhile ago. I'm not much of a web/jsp programmer so the taglibs
and expressions still puzzle me some.
 
Joined
Feb 28, 2008
Messages
1
Reaction score
0
Wendy S said:
<[email protected]> wrote

> I've tried: <%=idx+1%> but this does not work because idx is of type
> Integer, not int.


If idx is of type Integer, can't you call its methods?
<%= idx.intValue() + 1 %>

--
Wendy

Is there a way to do this with using the struts tag library and not a scriplet?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top