This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
If all you're doing is preserving checkbox states, you can model the checkboxes with a boolean array. When the time comes to initialize checkboxes, you simply iterate through the array and set the checkbox CHECKED attribute appropriately.
Whatever you do, don't go coding 100 if-else pairs. Whatever you do, don't go coding 100 if-else pairs.
I havent given it a lot of thought, but you can also have a String with 100 entries, each initialized to "CHECKED" or "", as per the saved state of the checkboxes. Then you can refer to it directly on the JSP without needing any conditinal check.
The future is here. It's just not evenly distributed yet. - William Gibson
Consultant @ Xebia. Sonny GillTweets
Joined: May 13, 2001
Thanks for the suggestions.
I like the idea of storing the checkbox state in an array, but I think there will be a problem with this. When the form is submitted, only those checkboxes that are actually checked get sent to the server. So, the order will not be maintained. I suppose you could give each checkbox a number, and then iterate through the values to set the state of the array but it's still not an ideal solution to me.