• 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 1 display ArrayList particular Element

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi..!

I have set an arraylist in request in action class
i want to display its 4 element in jsp page
How can i do this by using struts tag


Thanks in Advance
Raman S
 
Sheriff
Posts: 9707
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you want to display first 4 elements or 4 selected elements. If its the former then you can use the length property with the logic:iterate tag to achieve that...
 
RamandeepS Singh
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply Ankit

Ankit,
i want only 4th element of arraylist to be displayed
whatever the size of arraylist is

Thanks
Ramandeep Singh
 
Ranch Hand
Posts: 5575
Eclipse IDE Windows XP Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you can set the 4th element of ArrayList into the ActionForm in Action.and display it in jsp
 
RamandeepS Singh
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for your suggestion Ankit

But i just wana confirm dat isnt it possible in logic iterate as in JSP/servlet , we just request.getAttribute that arrayList and do Something like dis

<% ArrayList arr=(ArrayList)request.getAttribute("name");%>

<%=arr.get(4)%>

How could i do this in logic iterate
 
reply
    Bookmark Topic Watch Topic
  • New Topic