[Webwork-user] Getting a value from a map
Brought to you by:
baldree,
rickardoberg
From: Patrick L. <pli...@ci...> - 2002-06-27 17:45:55
|
My action has two methods: public Map availableInfoTypes(); public long getInfoType(); The Map is a Long/String pair, like so: {0=Select an InfoType, 1=InfoType 1, 2=InfoType 2, 3=InfoType 3, 4=InfoType 4} Now, if getInfoType() returns 2, I want to display the string "InfoType 2". But the code <ww:property value="possibleInfoTypes[infoType]"/> produces this error: java.lang.ClassCastException: java.lang.Long at java.lang.String.compareTo(String.java:792) at java.util.TreeMap.compare(TreeMap.java:1081) at java.util.TreeMap.getEntry(TreeMap.java:341) at java.util.TreeMap.get(TreeMap.java:260) at webwork.util.AbstractValueStack.findValue(AbstractValueStack.java:407) at webwork.view.taglib.WebWorkBodyTagSupport.findValue(WebWorkBodyTagSupport.ja va:54) Any ideas? -Pat |