• 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

Using collection attribute of logic:iterate

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to iterate over a string array declared in a JSP using the logic:iterate tag,

(sample snippet)

<%!
String[] temp = {"a","b"};
%>
<html>
<logic:iterate id = "element" collection = "<%=temp%>">
<%=element%>
</logic:iterate>
</html>

struts docs say that when using the collection attribute to iterate over a something like an array of primitives or objects, the value of the attribute should be a RT exprn/. that evaluates to the actual object that needs to be iterated over.

I assumed this is how it should be done. No luck. fails to iterate.

would appreciate any insights.

Thanks in advance
 
Sheriff
Posts: 67746
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
Since this is a Struts-specific tag, I've moved this to the Struts forum.

You might want to give some thought to replacing the use of proprietary tags such as this with JSTL tags.
 
Prassanna Srinivasan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear,

might end up using JSTL
 
reply
    Bookmark Topic Watch Topic
  • New Topic