This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts 1 display ArrayList particular Element Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Struts 1 display ArrayList particular Element" Watch "Struts 1 display ArrayList particular Element" New topic
Author

Struts 1 display ArrayList particular Element

RamandeepS Singh
Ranch Hand

Joined: Aug 25, 2009
Posts: 59
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
Ankit Garg
Saloon Keeper

Joined: Aug 03, 2008
Posts: 9189
    
    2

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...


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
RamandeepS Singh
Ranch Hand

Joined: Aug 25, 2009
Posts: 59
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
Seetharaman Venkatasamy
Ranch Hand

Joined: Jan 28, 2008
Posts: 5575

you can set the 4th element of ArrayList into the ActionForm in Action.and display it in jsp
RamandeepS Singh
Ranch Hand

Joined: Aug 25, 2009
Posts: 59
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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Struts 1 display ArrayList particular Element
 
Similar Threads
Cannot create iterator for FormBean
how to divide the database record into pages to display?
Next and previous buttons in jsp
Copying objects from one Arraylist to another Arraylist
ArrayList