Announcement Announcement Module
Collapse
No announcement yet.
XML Attribute Mapping? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Change workRequest to flowScope.workRequest or even ${flowScope.workRequest} -- flow scope should really be the default if its not specified -- we'll correct this for PR4. Could you open a JIRa issue on this?

    Comment


    • #17
      I have hit the same problem, I have this attributeMapper definition:

      Code:
      <bean id="news.item.attributeMapper" class="org.springframework.web.flow.support.ParameterizableFlowAttributeMapper">
        <property name="inputMappings">
          <map>
            <entry key="Item"><value>Item</value></entry>
            <entry ParentCategory"><value>ParentCategory</value></entry>
          </map>
        </property>
      </bean>
      I've tried to append flowScope., to use the Ognl expression ${flowScope.}, even to use a list instead of a map, but to no avail:

      Code:
      <bean id="news.item.attributeMapper" class="org.springframework.web.flow.support.ParameterizableFlowAttributeMapper">
        <property name="inputMappings">
          <list>
            <value>$&#123;flowScope.Item&#125;</value>
            <value>$&#123;flowScope.ParentCategory&#125;</value>
          </list>
        </property>
      </bean>
      With the above configuration, I get the error:

      Code:
      org.springframework.binding.expression.EvaluationException&#58; ognl.OgnlException&#58; target is null for setProperty&#40;null, "ParentCategory", null&#41;
              at org.springframework.binding.expression.support.OgnlExpressionEvaluator.set&#40;OgnlExpressionEvaluator.java&#58;44&#41;
              at org.springframework.binding.support.Mapping.map&#40;Mapping.java&#58;101&#41;
              at org.springframework.binding.support.ParameterizableAttributeMapper.map&#40;ParameterizableAttributeMapper.java&#58;174&#41;
              at org.springframework.web.flow.support.ParameterizableFlowAttributeMapper.createSubflowInput&#40;ParameterizableFlowAttributeMapper.java&#58;218&#41;
              at org.springframework.web.flow.SubflowState.createSubflowInput&#40;SubflowState.java&#58;224&#41;
              at org.springframework.web.flow.SubflowState.doEnter&#40;SubflowState.java&#58;198&#41;
              at org.springframework.web.flow.State.enter&#40;State.java&#58;164&#41;
              at org.springframework.web.flow.Transition.execute&#40;Transition.java&#58;269&#41;
              at org.springframework.web.flow.TransitionableState.onEvent&#40;TransitionableState.java&#58;202&#41;
              at org.springframework.web.flow.execution.impl.FlowExecutionImpl.signalEvent&#40;FlowExecutionImpl.java&#58;317&#41;
              at org.springframework.web.flow.execution.FlowExecutionManager.onEvent&#40;FlowExecutionManager.java&#58;290&#41;
              at org.springframework.web.flow.execution.FlowExecutionManager.onEvent&#40;FlowExecutionManager.java&#58;246&#41;
      ....
      ....
      Changing it to use the attribute-mapper tag, it works, but as I have many subflows with the same parameters, I would have prefered to maintain the attributemapper bean definition .

      Comment


      • #18
        I see the problem... in order for this to work right now in PR3 you'll need to use a map mapping like this:

        <map>
        <entry key="${flowScope.foo}" value="foo"/>
        </map>

        We'll correct this oversight for PR4

        Comment


        • #19
          It works

          Thanks for the tip, Keith, it works with this configuration.

          Comment


          • #20
            Mapping attributes between flows

            I'm having a hell of a time mapping attributes between flows because of similar exceptions to those reported in this thread.

            I've tried a number of permutations. Here is my latest failure:

            flow.xml:
            Code:
                <subflow-state id="launchEditFieldType" flow="fieldTypeFlow">
                    <attribute-mapper bean="fieldTypeMapper"/>
                    <transition on="finish" to="initList"/>
                    <transition on="error" to="initList"/>
                </subflow-state>
            dispatch-servlet.xml:
            Code:
                <bean id="frontController" name="/Flow" class="org.springframework.web.flow.mvc.FlowController">
                    <property name="cacheSeconds">
                        <value>5</value>
                    </property>
                    <property name="flowExecutionManager">
                        <bean class="org.springframework.web.flow.execution.servlet.ServletFlowExecutionManager">
                            <property name="storage">
                                <bean class="org.springframework.web.flow.execution.servlet.HttpSessionContinuationFlowExecutionStorage"/>
                            </property>
                            <property name="listener">
                                <bean class="com.leadconduit.web.spring.webflow.FieldTypeExecutionListener"/>
                            </property>
                        </bean>
                    </property>
                </bean>
            
                <bean id="fieldTypeMapper" class='org.springframework.web.flow.support.ParameterizableFlowAttributeMapper'>
                    <property name="inputMappings">
                        <map>
                            <entry key="$&#123;flowScope.fieldTypeId&#125;" value="fieldTypeId"/>
                        </map>
                    </property>
                </bean>
            ... Where the FieldTypeExecutionListener takes the source event request parameter called 'fieldTypeId' and inject it using the same name into the flow scope.

            I wind up with this:
            Code:
            org.springframework.beans.NotReadablePropertyException&#58; Invalid property 'flowScope.fieldTypeId' of bean class &#91;org.springframework.web.flow.execution.impl.StateContextImpl&#93;&#58; Bean property 'flowScope.fieldTypeId' is not readable or has an invalid getter method&#58; Does the return type of the getter match the parameter type of the setter?
            	at org.springframework.beans.BeanWrapperImpl.getPropertyValue&#40;BeanWrapperImpl.java&#58;634&#41;
            	at org.springframework.beans.BeanWrapperImpl.getPropertyValue&#40;BeanWrapperImpl.java&#58;626&#41;
            	at org.springframework.binding.expression.support.BeanWrapperEvaluator.evaluate&#40;BeanWrapperEvaluator.java&#58;25&#41;
            	at org.springframework.binding.support.Mapping.map&#40;Mapping.java&#58;91&#41;
            	at org.springframework.binding.support.ParameterizableAttributeMapper.map&#40;ParameterizableAttributeMapper.java&#58;174&#41;
            	at org.springframework.web.flow.support.ParameterizableFlowAttributeMapper.createSubflowInput&#40;ParameterizableFlowAttributeMapper.java&#58;218&#41;
            	at org.springframework.web.flow.SubflowState.createSubflowInput&#40;SubflowState.java&#58;224&#41;
            	at org.springframework.web.flow.SubflowState.doEnter&#40;SubflowState.java&#58;198&#41;
            	at org.springframework.web.flow.State.enter&#40;State.java&#58;164&#41;
            	at org.springframework.web.flow.Transition.execute&#40;Transition.java&#58;269&#41;
            	at org.springframework.web.flow.TransitionableState.onEvent&#40;TransitionableState.java&#58;202&#41;
            	at org.springframework.web.flow.execution.impl.FlowExecutionImpl.signalEvent&#40;FlowExecutionImpl.java&#58;317&#41;
            	at org.springframework.web.flow.execution.FlowExecutionManager.onEvent&#40;FlowExecutionManager.java&#58;289&#41;
            	at org.springframework.web.flow.execution.FlowExecutionManager.onEvent&#40;FlowExecutionManager.java&#58;245&#41;
            	at org.springframework.web.flow.execution.servlet.ServletFlowExecutionManager.handle&#40;ServletFlowExecutionManager.java&#58;77&#41;
            	at org.springframework.web.flow.mvc.FlowController.handleRequestInternal&#40;FlowController.java&#58;137&#41;
            	at org.springframework.web.servlet.mvc.AbstractController.handleRequest&#40;AbstractController.java&#58;128&#41;
            	at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle&#40;SimpleControllerHandlerAdapter.java&#58;44&#41;
            	at org.springframework.web.servlet.DispatcherServlet.doDispatch&#40;DispatcherServlet.java&#58;684&#41;
            	at org.springframework.web.servlet.DispatcherServlet.doService&#40;DispatcherServlet.java&#58;625&#41;
            	at org.springframework.web.servlet.FrameworkServlet.serviceWrapper&#40;FrameworkServlet.java&#58;386&#41;
            	at org.springframework.web.servlet.FrameworkServlet.doGet&#40;FrameworkServlet.java&#58;346&#41;
            Judging by the exception, it seems like 'flowScope.fieldTypeId' isn't equivalent to requestContext.getFlowScope().getAttribute('fieldT ypeId'). So how do I tell my mapper to take a request parameter and forward it along to a sub-flow?

            The purpose of the AttributeMapper is to take attributes in the parent flow's flowScope and add them to the child's flow's flowScope, is it not?

            Thanks for your help!
            -Alex

            Comment


            • #21
              Put OGNL in your classpath. The default Spring beans EL can't resolve map based structures with that format. We've clarified this for the next release.

              Comment


              • #22
                Similar problems with attribute-mapper

                I have run into some problems in getting the attribute mapper to work after porting my code to use preview release 3.

                In my xxx-servlet.xml file I have:

                <bean id="my.id.set" class="org.springframework.web.flow.action.Attribu teMapperAction">
                <property name="mapping" value="name" />
                </bean>

                <bean id="my.attributeMapper"
                class="org.springframework.web.flow.support.Parame terizableFlowAttributeMapper">
                <property name="inputMappings">
                <map>
                <entry key="name" value="name"/>
                </map>
                </property>
                </bean>

                My xxx-flow.xml has:

                <action-state id="my.set">
                <action bean="my.id.set"/>
                <transition on="success" to="arrayDesign.Detail"/>
                <transition on="error" to="error"/>
                </action-state>

                <subflow-state id="mySubflow.Detail" flow="mySubflow.Detail">
                <attribute-mapper bean="my.attributeMapper"/>
                <transition on="finish" to="criteria.view"/>
                <transition on="error" to="error"/>
                </subflow-state>

                The exception is:

                org.springframework.web.flow.ActionExecutionExcept ion: Exception thrown executing action 'org.springframework.web.flow.action.AttributeMapp erAction@4db085' in state 'arrayDesign.set' of flow 'arrayDesign.Search'; nested exception is org.springframework.binding.expression.EvaluationE xception: ognl.NoSuchPropertyException: org.springframework.web.flow.execution.impl.StateC ontextImpl.name
                org.springframework.binding.expression.EvaluationE xception: ognl.NoSuchPropertyException: org.springframework.web.flow.execution.impl.StateC ontextImpl.name
                at org.springframework.binding.expression.support.Ogn lExpressionEvaluator.evaluate(OgnlExpressionEvalua tor.java:32)
                at org.springframework.binding.support.Mapping.map(Ma pping.java:91)
                at org.springframework.binding.support.Parameterizabl eAttributeMapper.map(ParameterizableAttributeMappe r.java:174)

                ...

                Any ideas?

                Before I could set 'targetScopeAsString' = flow in the bean my.id.set. This is not supported in preview-release-3.

                Comment


                • #23
                  Carefully review this forum topic -- the answer is here.

                  Keith

                  Comment


                  • #24
                    Hmm. I should have mentioned that I have OGNL on the classpath. Also, I have added:

                    <map>
                    <entry key="${flowScope.name}" value="name"/>
                    </map>

                    but get:

                    org.springframework.beans.factory.BeanDefinitionSt oreException: Error registering bean with name 'arrayDesign.id.attributeMapper' defined in ServletContext resource [/WEB-INF/action-servlet.xml]: Could not resolve placeholder 'flowScope.name'
                    at org.springframework.beans.factory.config.PropertyP laceholderConfigurer.processProperties(PropertyPla ceholderConfigurer.java:223)

                    Thanks again, Keith.

                    Comment


                    • #25
                      Thanks!

                      Originally posted by Keith Donald
                      Put OGNL in your classpath. The default Spring beans EL can't resolve map based structures with that format. We've clarified this for the next release.
                      Thanks Keith!

                      Comment


                      • #26
                        I am using OGNL 2.67 and getting this error. Is there a specific version I need to use?

                        Comment


                        • #27
                          The spring property placeholder configurer is interfering here... can you disable the placeholder resolution checks? See the API for PropertyPlaceholderConfigurer.

                          Keith

                          Comment


                          • #28
                            Not exactly sure how to disable this. I have created a definition:

                            <bean id="propertyPlaceholderConfigurer"
                            class="org.springframework.beans.factory.config.Pr opertyPlaceholderConfigurer">
                            <property name="ignoreUnresolvablePlaceholders" value="true"/>
                            <property name="ignoreResourceNotFound" value="true"/>
                            </bean>

                            I get: Could not resolve placeholder 'flowScope.name' where name is the attribute I am trying to map.


                            my dispatcher-servlet.xml is:

                            <bean id="my.id.set"
                            class="org.springframework.web.flow.action.Attribu teMapperAction">

                            <property name="mapping" value="${flowScope.name}" />

                            </bean>

                            <bean id="my.id.attributeMapper"
                            class="org.springframework.web.flow.support.Parame terizableFlowAttributeMapper">
                            <property name="inputMappings">

                            <map>
                            <entry key="${flowScope.name}" value="name"/>
                            </map>

                            </property>
                            </bean>

                            My xxx-flow.xml is:

                            <action-state id="my.set">
                            <action bean="my.id.set"/>
                            <transition on="success" to="my.Detail"/>
                            <transition on="error" to="error"/>
                            </action-state>

                            <subflow-state id="my.Detail" flow="my.Detail">
                            <!-- <attribute-mapper bean="my.id.attributeMapper"/>-->

                            <attribute-mapper>
                            <input name="${flowScope.name}"/>
                            </attribute-mapper>

                            <transition on="finish" to="criteria.view"/>
                            <transition on="error" to="error"/>
                            </subflow-state>


                            Any help would be appreciated.

                            Thanks in advance.

                            -Kiran

                            Comment

                            Working...
                            X