Simon Rydberg wrote:
> Ok I have tried a lot of combinations...
>
>
> And received the following errors:
> Error looking up property "map.a"
> Error looking up property "map.(a)"
> Error looking up property "map.get(a)"
> Error looking up property "map(a)"
Looks like that approach isn't going to work. I've one last idea. I
don't like it much as it feels like a hack to me but anyway.
1. Create a TableDecorator
public class MyDecorator extends TableDecorator {
// These are hard coded - yours don't have to be
private String[] keys = new String[] {"a", "b", "c"};
private int index = 0;
public String startRow() {
//New row reset the index
index = 0;
}
public String getMapValue() {
// Too many columns not enough keys
if (index >= keys.length) {
return "error!";
}
MyMap m = (MyMap)this.getCurrentRowObject();
String value = m.getMap().get(keys[index]);
index++;
return value;
}
}
and your displaytag becomes:
<display:table name="testis" export="true" decorator="MyDecorator">
<display:column property="mapValue" title="A*"/>
<display:column property="mapValue" title="B*"/>
<display:column property="mapValue" title="C*"/>
</display:table>
When DisplayTag uses the decorator to get the mapValue for each column
the decorator advances the index by one and so the next call to mapValue
retrieves a different value from the map.
Ed!
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
displaytag-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/displaytag-user