Hi all,
I have a requirement to display results of a collection alphabetically, i.e.:
Pets:
A
Aardvark
B
Bat
Beluga
C
Cat
Crayfish
...
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:
<s:iterator value="petList">
<li><s:if test='%{type.toLower.startsWith("a")}'><s:a href="%{url}"><s
roperty value="type" escape="false"/></s:a></s:if></li>
</s:iterator>
but it doesn't work (I'm very new to this). How can I do this? Any help gratefully appreciated. I am using
Struts 2.