Results 1 to 2 of 2

Thread: pass parameter from HTML to Flow not working

  1. #1

    Default pass parameter from HTML to Flow not working

    hi,

    I am passing a parameter in flow start. I want to use this parameter in my flow

    i am passing the parameter as this way in the html.

    <A href="customobject.htm?_flowId=CustomField-flow&objectId=2593">Custom Objects</A>


    in the flow .xml
    Code:
        <?xml version="1.0" encoding="UTF-8"?>
    <flow xmlns="http://www.springframework.org/schema/webflow"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://www.springframework.org/schema/webflow
                              http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd">
    
        <var name="customFieldType" class="com.sb.model.CustomFieldType" scope="conversation"/>
      	<var name="customField" class="com.sb.model.CustomField" scope="conversation"/>
    
    
    
    	<start-actions>
           <set attribute="objectId" scope="flow" value="${requestParameters.objectId}"/>
    	  </start-actions>
    
    
    <view-state id="displayFieldType4" view="CustomField4">
    		<render-actions>
    			<bean-action bean="customFieldDAO" method="getPageLayouts">
    				<!--
    				<method-arguments>
    					<argument expression="requestParameters" />			
    				</method-arguments>
    				-->
    				<method-arguments>
    					<argument expression="${requestParameters.objectId}" parameter-type="int"/>			
    				</method-arguments>
    				<method-result name="results"/>
    			</bean-action>
    		</render-actions>
    I am getting this error while rendering the page.

    org.springframework.webflow.engine.ActionExecution Exception: Exception thrown executing [AnnotatedAction@1a0b94d targetAction = org.springframework.webflow.action.LocalBeanInvoki ngAction@e59e40, attributes = map[[empty]]] in state 'displayFieldType4' of flow 'CustomField-flow' -- action execution attributes were 'map[[empty]]'; nested exception is org.springframework.binding.method.MethodInvocatio nException: Unable to invoke method [MethodSignature@f8ae79 methodName = 'getPageLayouts', parameters = [[Parameter@17044c5 type = Integer, name = requestParameters.objectId]]] with arguments array<Object>[[null]]; nested exception is java.lang.IllegalArgumentException


    How do i pass the parameter to my method argument.


  2. #2
    Join Date
    Feb 2007
    Posts
    8

    Default

    Quote Originally Posted by fxthomas View Post
    hi,

    I am passing a parameter in flow start. I want to use this parameter in my flow

    i am passing the parameter as this way in the html.

    <A href="customobject.htm?_flowId=CustomField-flow&objectId=2593">Custom Objects</A>


    in the flow .xml
    Code:
        <?xml version="1.0" encoding="UTF-8"?>
    <flow xmlns="http://www.springframework.org/schema/webflow"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://www.springframework.org/schema/webflow
                              http://www.springframework.org/schema/webflow/spring-webflow-1.0.xsd">
    
        <var name="customFieldType" class="com.sb.model.CustomFieldType" scope="conversation"/>
      	<var name="customField" class="com.sb.model.CustomField" scope="conversation"/>
    
    
    
    	<start-actions>
           <set attribute="objectId" scope="flow" value="${requestParameters.objectId}"/>
    	  </start-actions>
    
    
    <view-state id="displayFieldType4" view="CustomField4">
    		<render-actions>
    			<bean-action bean="customFieldDAO" method="getPageLayouts">
    				<!--
    				<method-arguments>
    					<argument expression="requestParameters" />			
    				</method-arguments>
    				-->
    				<method-arguments>
    					<argument expression="${requestParameters.objectId}" parameter-type="int"/>			
    				</method-arguments>
    				<method-result name="results"/>
    			</bean-action>
    		</render-actions>
    I am getting this error while rendering the page.

    org.springframework.webflow.engine.ActionExecution Exception: Exception thrown executing [AnnotatedAction@1a0b94d targetAction = org.springframework.webflow.action.LocalBeanInvoki ngAction@e59e40, attributes = map[[empty]]] in state 'displayFieldType4' of flow 'CustomField-flow' -- action execution attributes were 'map[[empty]]'; nested exception is org.springframework.binding.method.MethodInvocatio nException: Unable to invoke method [MethodSignature@f8ae79 methodName = 'getPageLayouts', parameters = [[Parameter@17044c5 type = Integer, name = requestParameters.objectId]]] with arguments array<Object>[[null]]; nested exception is java.lang.IllegalArgumentException


    How do i pass the parameter to my method argument.

    one thing that i noticed in the code snippet, is that you have defined objectId as a flow level object, so try changing your method to get the object from flowScope vs request.

    Code:
      <argument expression="${flowScope.objectId}"  parameter-type="int"/>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •