This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Passing dynamic values in the value attribute of ITERATOR Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Passing dynamic values in the value attribute of ITERATOR" Watch "Passing dynamic values in the value attribute of ITERATOR" New topic
Author

Passing dynamic values in the value attribute of ITERATOR

Rajaprabhu Aravindasamy
Greenhorn

Joined: Dec 26, 2011
Posts: 25
Hello guys...!

I am having a problem with assigning dynamic values with value attribute of ITERATOR..!
My problem is..,

I had added some details into an array of arraylist in action class.[ ArrayList[] arr=new ArrayList[cnt] ...... arr[i].add(somebean)]
So in the arraylist 'arr', each cell is containing an arraylist i.e) group of objects.
And i had written a getter in the action class.[ public ArrayList[] getDetails(){ .... } ]

My question is..,
how can i access that array of arraylist in jsp with ITERATOR..?
Is there any way to pass dynamic values(0,1,..n) to the value attribute in ITERATOR..?

please refer the following code to analyse my scenario..!

(display-> dto objecj.
arr-> array of arraylists.)



i want to change the value in the place of question mark dynamically..! please help..!
alternative ways will also be appreciated..!
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

Please refer the following link HowToUseIterator


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
Rajaprabhu Aravindasamy
Greenhorn

Joined: Dec 26, 2011
Posts: 25
Hai.., Mohan Rao...

I know how to use iterator...! Please read my post fully and then reply for that..!
I am seeking a solution to pass array of arraylist into the value attribute..!
or pass dynamic values to the value attribute in iterator..!

The following code is working, if i set the array index as 0 but i need to pass the dynamic values from the loop (0,1..n)...,

<% for(some condition)
{ %>
<s:iterator value="display.arr[0]">
.
.
</s:iterator>

<% } %>

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Passing dynamic values in the value attribute of ITERATOR
 
Similar Threads
iterate list issue...
s:iterator issue
Struts2 - <s:iterator> in two-Dimensional Array.
Struts2: Retern all the values inside the list in my Action
Accessing array of array list in Jsp using ITERATOR tag of Struts2