Snap map in spring mvc

I have a form in spring mvc 2 with the class of commands "Class1"

I want to associate class 3 elements with an input field in this form. Below are my classes.

I am iterating / snapping to class 2 elements in a JSP other than a map like this

<c:forEach var="item" items="${class1.class2List}" varStatus="itemsRow"> <form:input path="class2List[${itemsRow.index}].anyElement2" /> .......... </c:forEach> 

My classes look like

 Class1 List<Class2> class2List; String anyElement1; Class2 Map<String, Class3> class2Map; String anyElement2; Class3 Map<String, Class3> class3Map; String nameToGet; String anyElement3; 

How to bind anyElement3 inside class3Map . Is it possible?

Edited for the first answer

 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) 
0
source share
2 answers

Assuming your class2Map has an entry with a key, say mapkey , try this:

 <form:input path="class2List[${itemsRow.index}].class2Map['mapkey'].anyElement3" /> 
+3
source

org.springframework.beans.NullValueInNestedPathException: Invalid property 'prsCDData [Forced] [0]'

As in the above exception, how would you have the property โ€œprsCDData [Forced] [0]โ€ in any object ?, I think the value of your path is incorrect.

0
source

All Articles