wood burning stoves 2.0*
The moose likes Struts and the fly likes How to generate dynamic list of checkboxlist  selection 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 "How to generate dynamic list of checkboxlist  selection" Watch "How to generate dynamic list of checkboxlist  selection" New topic
Author

How to generate dynamic list of checkboxlist selection

Nachiket Patel
Ranch Hand

Joined: Sep 16, 2007
Posts: 110
In Action class [ActionSupport extended]
1. equipmentSpeed is object (with get & set method in Action Class), which has getDiscreteConstrains() method which returns List<DiscreteConstrain> object.
DiscreteConstrain has getPossibleValues() method which returns List<String>

2. There is one more object limitPossibleConstrains of class DiscreteConstrain in Action.

I want to iterate over equipmentSpeed.discreteConstrains and get possibleValues which should be selected [checkboxes] and parent set(items of checkbox) should be limitPossibleConstrains[i].possibleValues value


Please identify why following code is not working... [OR Suggest alternative solution..]


Before software can be reusable, it first has to be usable. - Ralph Johnson
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

When you iterate over a list, items in the list are placed on top of the value stack. Your iterator tag is useless. You are only using it like a for loop to get index locations. You should use the element i.e. DiscreteContrain elements placed on top of the value stack by the iterator. This code should work but I've not tried it (I don't understand your problem correctly so my code might not be according to what you want)



Also please go through the iterator tag reference and checkboxlist tag reference once.


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
Consider Paul's rocket mass heater.
 
subject: How to generate dynamic list of checkboxlist selection
 
Similar Threads
Struts 2 forms and collections
s:select tag issue in struts2
Struts 2 - Problem updating textfields created by iterating over a list of objects
How to get Iterating value in a list of VO struts2