<logic:iterate /> iterate beyond items in the collection

Discussion in 'Java' started by Gogo, Sep 4, 2003.

  1. Gogo

    Gogo Guest

    Hi,

    I have been able to iterate through the collection of items using
    <logic:iterate /> from the Struts tld.

    My problem is to present the user with a form with prepopulated
    values.
    The values are populated from the items within the collection.

    Using the following helps me in showing the values within the
    collection.

    <logic:iterate collection="<%=myCollection%>" id="col">
    Enter Name : <html:text name="col" property="name">
    </logic:iterate>

    But, what if my collection is null or my collection has 0 items? I
    still want
    to display the textboxes to the user for entering the list of names
    (say, at least 10). I guess, it must be a very small and easy
    solution. Being totally new to Struts, I can't locate a property on
    logic:iterate which could tell it to display the textboxes even if
    there are no items.

    TIA,
    Gogo
    Gogo, Sep 4, 2003
    #1
    1. Advertising

  2. Gogo

    Sudsy Guest

    Gogo wrote:
    > Hi,
    >
    > I have been able to iterate through the collection of items using
    > <logic:iterate /> from the Struts tld.
    >
    > My problem is to present the user with a form with prepopulated
    > values.
    > The values are populated from the items within the collection.
    >
    > Using the following helps me in showing the values within the
    > collection.
    >
    > <logic:iterate collection="<%=myCollection%>" id="col">
    > Enter Name : <html:text name="col" property="name">
    > </logic:iterate>
    >
    > But, what if my collection is null or my collection has 0 items? I
    > still want
    > to display the textboxes to the user for entering the list of names
    > (say, at least 10). I guess, it must be a very small and easy
    > solution. Being totally new to Struts, I can't locate a property on
    > logic:iterate which could tell it to display the textboxes even if
    > there are no items.
    >
    > TIA,
    > Gogo


    Check into logic:present and logic:notPresent
    Sudsy, Sep 4, 2003
    #2
    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. Zhao

    logic:iterate in struts

    Zhao, Sep 11, 2003, in forum: Java
    Replies:
    2
    Views:
    8,401
    Sudsy
    Sep 11, 2003
  2. Zhao
    Replies:
    0
    Views:
    581
  3. runescience
    Replies:
    0
    Views:
    1,454
    runescience
    Feb 9, 2006
  4. Øyvind Isaksen
    Replies:
    1
    Views:
    964
    Øyvind Isaksen
    May 18, 2007
  5. John
    Replies:
    4
    Views:
    910
    RedGrittyBrick
    Apr 1, 2008
Loading...

Share This Page