This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma 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.
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.
I will have to think some more about this...
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com