• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts Iterator Query

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Struts 1.1.
Java 1.5
Tomcat 5.5.9

Hi,

I'm really struggling with an embeded logic:iterate tag, and was hoping someone could point me in the right direction.

what I'm trying to achieve is the following

retrieve all products from by db for a selected subcategory.
display every product on the jsp, i.e. iterate through the 'ProductList' in the request.
for each product provide a selection box containing all it's size options (product_size_array property of the Product object)

I have the following but it isn't correct as no product sizes are being printed out, although the OUTER iterator is running fine as the name details for each product can be printed no problems.

<!--Iterate around all products in the ProductList LinkedHashSet-->
<logic:iterate id="Product" name="ProductsList" type="net.domain.Product" scope="request">

<!--For each product Iterate through it's product_size_array property which is a LinkedHashSet containing String objects-->
<select name="product_size" size="1">
<logic:iterate id="product_size" name="Product" property="product_size_array" type="java.lang.String">
<option value="<bean:write name='product_size'/>"><bean:write name="product_size"/></option>
</logic:iterate>
</select>

</logic:iterate>



Thanks.
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

We have a forum dedicated to Struts questions to which this post has been moved.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'd suggest using the <html:options> tag rather than <logic:iterate>. The <logic:options> tag renders all the options in a collection. Here is a link to the documentation.
[ September 09, 2006: Message edited by: Merrill Higginson ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic