Map p = new HashMap(); p.put("1", "name1"); p.put("2", "name2");
and I want to iterate over the map to show a list of checkboxes whose name will correspond to an indexed property in the form and value will be "1", "2" etc.. and the labels next to the checkboxes will be name1, name2
I would eschew using a map for this, because sometime in the future you may want to have checkboxes mapped to the same value, and it will be very frustrating to manage this. I feel that a better choice would be to create a List of LabelValueBeans, and then iterate through these. If you create the list as some kind of a lookup object then you'll be able to just "grab" the list you need whenever you need it.
Danilo Gurovich<br />Manager, Web Development<br /> <br />email@example.com<br />2401 Colorado Ave., 2nd Floor <br />Santa Monica, CA 90404<br />(310) 998-6412
posted 15 years ago
Sorry for the double posting, I hit the reply button too fast. Here's my answer.
Here's a little snippet of code showing <logic:iterate/> tags used to create checkboxes (using a String here: