• 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

List-Backed

 
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
can any one please tell me. How can i use list-backed feature of struts and display the same using jstl.

thnx
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To display a list is quite easy. Just create a property of type List in your ActionForm that represents a list of JavaBeans. Then populate the list in your Action class. Your JSP would then look something like this:

<c:forEach var="bean" items="${myForm.myList}" >
<c:out value="${bean.property1}" />
<c:out value="${bean.property2}" />
<c:out value="${bean.property3}" />
</c:forEach>

If you need to create input fields for each member of the list, it's a bit more complicated. You need to use indexed properties and create indexed getters and setters in your ActionForm. The following two links give you more information on how to use indexed properties.

http://struts.apache.org/1.2.9/faqs/indexedprops.html
http://wiki.apache.org/struts/StrutsCatalogLazyList
[ October 15, 2006: Message edited by: Merrill Higginson ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic