Struts <logic:iterate> Tag & the indexId property

Discussion in 'Java' started by mikelsmith@hotmail.com, Feb 10, 2005.

  1. Guest

    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.
    , Feb 10, 2005
    #1
    1. Advertising

  2. Wendy S Guest

    <> 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
    Wendy S, Feb 10, 2005
    #2
    1. Advertising

  3. 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.
    TheVooDooChild, Feb 10, 2005
    #3
  4. yehuda54

    Joined:
    Feb 28, 2008
    Messages:
    1
    Is there a way to do this with using the struts tag library and not a scriplet?

    Thanks
    yehuda54, Feb 28, 2008
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gogo
    Replies:
    1
    Views:
    2,083
    Sudsy
    Sep 4, 2003
  2. Zhao
    Replies:
    11
    Views:
    43,710
    pmckeen
    Jul 7, 2009
  3. Jack_A

    Struts tag <logic:iterate>

    Jack_A, May 18, 2004, in forum: Java
    Replies:
    1
    Views:
    8,772
    Martin
    May 19, 2004
  4. javadude
    Replies:
    2
    Views:
    5,885
    Wendy Smoak
    Jun 30, 2005
  5. Replies:
    3
    Views:
    3,615
Loading...

Share This Page