I am having problems with the OGNL syntax and possibly action setup of my web-application.
Scenerio, I want to create a struts2 <struts2:select name="event.dj_map" list="event.dj_map" size="5" multiple="true"> that will submit a map<
string,string> to my custom javabean that my action places on the stack (Event.java). After I get this working I'll change to map<long, string> (my id's are stored as longs), I don't think that change will incur any problems.
Also, I don't think this matters but, my .jsp has javascript code that can add elements (options with value & bodytext elements) if the user should want to.
JSP: manage-event.jsp called from /secure/ManageEvents_create.action?subdomain=yadayadayada (accessible only by logged in users via authenticationInterceptor)
XML: struts.xml snippet
ACTION: ManageEvents.java
JAVA: Event.java (relevant parts)
ERROR: ognlNoSuchMethodException
WARNING: Error setting value
ognl.MethodFailedException: Method "setDj_map" failed for object com.mycityonline.events.Event@e2fa0e [java.lang.NoSuchMethodException: setDj_map([Ljava.lang.String;)]
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:823)
at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:964)
at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:75)
at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:131)
at com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:28)
at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
at ognl.ASTProperty.setValueBody(ASTProperty.java:101)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
at ognl.SimpleNode.setValue(SimpleNode.java:246)
at ognl.ASTChain.setValueBody(ASTChain.java:172)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
at ognl.SimpleNode.setValue(SimpleNode.java:246)
at ognl.Ognl.setValue(Ognl.java:476)
at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:192)
at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:155)
at com.opensymphony.xwork2.ognl.OgnlValueStack.setValue(OgnlValueStack.java:143)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.setParameters(ParametersInterceptor.java:273)
.....
at java.lang.Thread.run(Thread.java:619)
/-- Encapsulated exception ------------\
java.lang.NoSuchMethodException: setDj_map([Ljava.lang.String;)
at ognl.OgnlRuntime.callAppropriateMethod(OgnlRuntime.java:810)
at ognl.OgnlRuntime.setMethodValue(OgnlRuntime.java:964)
at ognl.ObjectPropertyAccessor.setPossibleProperty(ObjectPropertyAccessor.java:75)
at ognl.ObjectPropertyAccessor.setProperty(ObjectPropertyAccessor.java:131)
at com.opensymphony.xwork2.ognl.accessor.ObjectAccessor.setProperty(ObjectAccessor.java:28)
at ognl.OgnlRuntime.setProperty(OgnlRuntime.java:1656)
at ognl.ASTProperty.setValueBody(ASTProperty.java:101)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
at ognl.SimpleNode.setValue(SimpleNode.java:246)
at ognl.ASTChain.setValueBody(ASTChain.java:172)
at ognl.SimpleNode.evaluateSetValueBody(SimpleNode.java:177)
at ognl.SimpleNode.setValue(SimpleNode.java:246)
at ognl.Ognl.setValue(Ognl.java:476)
at com.opensymphony.xwork2.ognl.OgnlUtil.setValue(OgnlUtil.java:192)
...
at java.lang.Thread.run(Thread.java:619)
Can anyone shed any light or links on how to get a mapped multiple select into your pojo with OGNL and STRUTS2? The examples I've seen are ALL of multiple struts2:textfields going into a map, I have YET to see any code of a multiple select being mapped to a map in a pojo. Seems like it should be extremely common. I even tried to "trick" java by implementing a dummy setDj_map(String str_map) just to see if I could kill the error to no avail :-/
research thus far:
http://www.zorched.net/2009/07/02/struts2-map-form-to-collection-of-objects/
http://struts.apache.org/2.0.14/docs/select.html
http://www.roseindia.net/struts/struts2/struts2uitags/select-tag.shtml
Thanks for any assistance/guidance/direction you can provide :-)!