I have a navigation bar whose elements are rendered using Struts2 iterator tag like below:
<ul>
<li><a href="#">Home</a></li>
<s:iterator var="row" value="#session.PrivMenu.children" status="stat">
<li>
<a href="#" rel="ddsubmenu<s:property value="#stat.index+1"/>">
<s:property value="#row.moduleName"/>
</a>
</li>
</s:iterator>
</ul>
Now I have to apply an icon with each <a> element. Since the icon is going to be different for each navbar element, a different styling will be required for each <a> tag.
How can I achieve this in struts2 ??
I thought of dynamic cssClass attribute.
cssClass = '<s:property value="#row.moduleName"/>' + icon
But I think like this later if module name changes, I will have to edit my css too. Am I going wrong??? Any better idea?