Hello, I am using spring 3.0.5 with webflow 2.3 in a jetspeed portlet environment running on tomcat 6
I am trying to migrate a page from spring mvc to spring webflow and have run into an issue with the dynamic list binding. My page has a list of textboxes and a button to add more textboxes via javascript. The controls are indexed as such:
Model class:Code:<input id="strings0" name="strings[0]" value="this is the first string" type="text"> <input id="strings1" name="strings[1]" value="this is the second string" type="text">
My mvc implementation originally used a linked list called "strings" and has been working fine. However, i need to migrate this page to spring webflow and have not been able to get the newly created textboxes to bind.Code:public class TestMdl implements Serializable{ private List<String> strings; public TestMdl() { strings=new AutoPopulatingList<String>(String.class); } ...
I have tried switching from a LinkedList to an AutoPopulatingList
I have tried the suggestions from http://forum.springsource.org/showth...ding-supported but none of it seems to make a difference,
I will say that my MVC implementation that i still have working has continued to work while I changed from a LinkedList implementation to the AutoPopulatingList.
As long as the list is populated before render (testService.getStrings()) then I can bind without problem, only newly added objects fail.
flow:
Here are some of the logs after attempting to add a couple of strings. There was already one string in the list(prepopulated before loading the page by the getStrings method) so the binding failed on the second text string.Code:<view-state id="test" model="testMdl"> <on-render> <evaluate expression="testService.getStrings()" result="flowScope.testMdl"/> </on-render> <transition on="update" to="test" > <evaluate expression="testService.update(testMdl)"/> </transition> </view-state>
Any help would be greatly appreciated.Code:09:48:55,155 DEBUG org.springframework.webflow.mvc.view.AbstractMvcView - Processing user event 'update' 09:48:55,155 DEBUG org.springframework.webflow.mvc.view.AbstractMvcView - Resolved model org.test.portlet.model.TestMdl@7f7ad911 09:48:55,155 DEBUG org.springframework.webflow.mvc.view.AbstractMvcView - Binding to model 09:48:55,156 DEBUG org.springframework.webflow.mvc.view.AbstractMvcView - Adding default mapping for parameter 'strings[0]' 09:48:55,156 DEBUG org.springframework.webflow.mvc.view.AbstractMvcView - Adding default mapping for parameter 'strings[1]' 09:48:55,156 DEBUG org.springframework.webflow.mvc.view.AbstractMvcView - Adding default mapping for parameter 'execution' 09:48:55,156 DEBUG org.springframework.binding.mapping.impl.DefaultMapper - Beginning mapping between source [org.springframework.webflow.core.collection.LocalParameterMap] and target [org.test.portlet.model.TestMdl] 09:48:55,156 DEBUG org.springframework.core.convert.support.GenericConversionService - Converting value 0 of java.lang.Integer to java.lang.Integer 09:48:55,156 TRACE org.springframework.core.convert.support.GenericConversionService - Matched cached converter java.lang.Number -> java.lang.Number : org.springframework.core.convert.support.NumberToNumberConverterFactory@53067d4c 09:48:55,156 DEBUG org.springframework.core.convert.support.GenericConversionService - Converted to 0 09:48:55,156 DEBUG org.springframework.core.convert.support.GenericConversionService - Converting value 'first' of java.lang.String to java.lang.String 09:48:55,156 TRACE org.springframework.core.convert.support.GenericConversionService - Matched cached converter org.springframework.core.convert.support.ObjectToStringConverter@32aa73e8 09:48:55,156 DEBUG org.springframework.core.convert.support.GenericConversionService - Converted to 'first' 09:48:55,156 DEBUG org.springframework.binding.mapping.impl.DefaultMapping - Adding mapping result [Success@5a412c79 mapping = parameter:'strings[0]' -> strings[0], code = 'success', error = false, originalValue = 'first', mappedValue = 'first'] 09:48:55,156 DEBUG org.springframework.core.convert.support.GenericConversionService - Converting value 1 of java.lang.Integer to java.lang.Integer 09:48:55,156 TRACE org.springframework.core.convert.support.GenericConversionService - Matched cached converter java.lang.Number -> java.lang.Number : org.springframework.core.convert.support.NumberToNumberConverterFactory@53067d4c 09:48:55,156 DEBUG org.springframework.core.convert.support.GenericConversionService - Converted to 1 09:48:55,156 DEBUG org.springframework.binding.mapping.impl.DefaultMapping - Adding mapping result [TargetAccessError@6cceea39 mapping = parameter:'strings[1]' -> strings[1], code = 'evaluationException', error = true, errorCause = org.springframework.binding.expression.EvaluationException: An ELException occurred setting the value of expression 'strings[1]' on context [class org.test.portlet.model.TestMdl] to [second], originalValue = 'second', mappedValue = [null]] 09:48:55,157 DEBUG org.springframework.binding.mapping.impl.DefaultMapping - Adding mapping result [TargetAccessError@39d162fa mapping = parameter:'execution' -> execution, code = 'propertyNotFound', error = true, errorCause = org.springframework.binding.expression.PropertyNotFoundException: Property not found, originalValue = array<String>['e2s1', 'e2s1'], mappedValue = [null]] 09:48:55,157 DEBUG org.springframework.binding.mapping.impl.DefaultMapper - Completing mapping between source [org.springframework.webflow.core.collection.LocalParameterMap] and target [org.test.portlet.model.TestMdl]; total mappings = 3; total errors = 2 09:48:55,157 DEBUG org.springframework.webflow.mvc.view.AbstractMvcView - Model binding resulted in errors; adding error messages to context 09:48:55,157 DEBUG org.springframework.core.convert.support.GenericConversionService - Converting value 1 of java.lang.Integer to java.lang.Integer 09:48:55,157 TRACE org.springframework.core.convert.support.GenericConversionService - Matched cached converter java.lang.Number -> java.lang.Number : org.springframework.core.convert.support.NumberToNumberConverterFactory@53067d4c 09:48:55,157 DEBUG org.springframework.core.convert.support.GenericConversionService - Converted to 1 09:48:55,158 DEBUG org.springframework.webflow.engine.impl.FlowExecutionImpl - Attempting to handle [org.springframework.webflow.execution.FlowExecutionException: Exception thrown in state 'test' of flow 'view'] with root cause [org.springframework.expression.spel.SpelEvaluationException: ... 09:48:55,164 ERROR org.test.portlet.util.DefaultExeceptionResolver - Unhandled Exception: org.springframework.webflow.execution.FlowExecutionException: Exception thrown in state 'test' of flow 'view' at org.springframework.webflow.engine.impl.FlowExecutionImpl.wrap(FlowExecutionImpl.java:571) at org.springframework.webflow.engine.impl.FlowExecutionImpl.resume(FlowExecutionImpl.java:265) ... Caused by: org.springframework.binding.expression.EvaluationException: An ELException occurred getting the value type for expression 'strings[1]' on context [class org.test.portlet.model.TestMdl] at org.springframework.binding.expression.spel.SpringELExpression.getValueType(SpringELExpression.java:105) ... Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1025E:(pos 7): The collection has '1' elements, index '1' is invalid at org.springframework.expression.spel.ast.Indexer.getValueInternal(Indexer.java:122) at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:57) at org.springframework.expression.spel.standard.SpelExpression.getValueType(SpelExpression.java:114) at org.springframework.binding.expression.spel.SpringELExpression.getValueType(SpringELExpression.java:100) ... 80 more


Reply With Quote
