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.
I have a requirement to display results of a collection alphabetically, i.e.:
... I need to access rows of collection petList, test if they begin with a certain letter, and if so display them in the appropriate alphabetical block of the page. I think I need to do something like this for each letter of the alphabet:
If it can be done outside of the JSP, it should be done outside of the JSP.
I'd suggest you do all the heavy lifting for this in your Action class. One approach would be to create a Map<String, List> with the key being the letter of the alphabet, and the value being a List of items that start with that letter. In your JSP, just iterate through the list of Map.Entry objects and then iterate through the list of items in each entry.