在springmvc绑定地图
我在spring mvc 2中有一个表单,命令类为“Class1”
我想将Class3元素与此表单中的输入字段绑定。 以下是我的课程。
我正在迭代/绑定JSP中的Class2元素而不是像这样的map
..........
我的课看起来像
Class1 List class2List; String anyElement1; Class2 Map class2Map; String anyElement2; Class3 Map class3Map; String nameToGet; String anyElement3;
如何在class3Map
绑定class3Map
。 可能吗?
编辑第一个答案
Caused by: org.springframework.beans.NullValueInNestedPathException: Invalid property 'class2List[0].class2Map[0]' of bean class [com.Class1]: Could not instantiate property type [com.Class3] to auto-grow nested property path: java.lang.InstantiationException: com.Class3 at org.springframework.beans.BeanWrapperImpl.newValue(BeanWrapperImpl.java:641)
假设你的class2Map
有一个带键的条目,比如class2Map
,试试这个:
org.springframework.beans.NullValueInNestedPathException:无效的属性’prsCDData [Forced] [0]’
如上所述,你如何在任何对象中拥有属性’prsCDData [Forced] [0]’? 。 我认为你的路径价值是错误的。