-
Aug 9th, 2012, 04:40 AM
#1
Usage of growCollectionIfNecessary() in BeanWrapperImpl class
Hi,
We are currently facing the same issue which is mentioned http://forum.springsource.org/showth...-form-in-MVC-3 link.
I have not got the reply so I have opened the seperate thread.
We are migrating our applications from Spring 2.5 to Spring 3.1 . I can see there is change in BeanWrapperImpl class in Spring's new 3.1 jar. growCollectionIfNecessary() method has been added which was not there initially. It is actually inserting new value object(with all blank values) at the 0th position of our Dynamic list. and later adding the rows of the Grid. For Exp: If we have two rows in Grid and when we submit, With Spring 3.1 we can see three rows in our controller and first value is blank value object.
Code Snippet getPropertyValue of Spring 3.1 is as follows,
private Object getPropertyValue(PropertyTokenHolder tokens) throws BeansException {
...
else if (value instanceof List) {
int index = Integer.parseInt(key);
List list = (List) value;
growCollectionIfNecessary(list, index, indexedPropertyName, pd, i + 1);
value = list.get(index);
}
Code snippet of Spring 2.5 code is as follows
Code:
private Object getPropertyValue(PropertyTokenHolder tokens) throws BeansException {
...
else if (value instanceof List) {
List list = (List) value;
value = list.get(Integer.parseInt(key));
}
Just wanted to know what is the usage of the new growCollectionIfNecessary() method in Spring 3.1. And how can we avoid first blank value object getting inserted in our collection. This is the method which is adding the blank collection.
Note: We have not yet annoted our controllers yet and We are still using the deprecated controllers of Spring 2.5.
Please guide us on this. Thanks
Regards
Shiv
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules