Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/329.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring流:在主WebFlow和子流之间来回传递对象_Java_Spring Webflow - Fatal编程技术网

Java Spring流:在主WebFlow和子流之间来回传递对象

Java Spring流:在主WebFlow和子流之间来回传递对象,java,spring-webflow,Java,Spring Webflow,我正在从主流调用一个子流。我已经能够将一个对象ShareHolderProfile从主流传递到子流。但是,我不确定这个对象是否没有被传递回MainFlow,或者我没有在JSP中正确地访问它。下面是我是怎么做的 MainFlow.xml SubFlow.xml 现在,在大多数情况下,应用程序中的流运行良好。然而,问题是我一直在尝试从我的一个jsp中的acctProfile访问一些属性(成员变量)。类似于-acctProfile.FirstName的内容 然而,我无法做到这一点。acctPr

我正在从主流调用一个子流。我已经能够将一个对象
ShareHolderProfile
从主流传递到子流。但是,我不确定这个对象是否没有被传递回MainFlow,或者我没有在JSP中正确地访问它。下面是我是怎么做的

MainFlow.xml

SubFlow.xml

现在,在大多数情况下,应用程序中的流运行良好。然而,问题是我一直在尝试从我的一个jsp中的acctProfile访问一些属性(成员变量)。类似于-acctProfile.FirstName的内容

然而,我无法做到这一点。acctProfile对象没有从子流传递到Mainflow,或者我在JSP中没有正确使用它。请告知

提前感谢

2件事:

  • 声明输入(或输出)参数时,请确保添加要传递的对象的类型(这可能就是您无法访问actProfile属性的原因)。例如,如果actProfile的类类型为com.mycompany.actProfile,则应按以下方式声明:

    您需要在MainFlow.xml和SubFlow.xml中都这样做

  • 为了访问actProfile(从子流到主流),您应该将其声明为从子流到主流的输出变量。这是如何做到的:

  • MainFlow.xml:

    <subflow-state id="createAccountSubFlow" subflow="createAccountSubFlow">
        <input name="actProfile" value="actProfile" type="com.mycompany.ActProfile" />  
        <output name="actProfile" value="actProfile" type="com.mycompany.ActProfile" /> 
        <transition on="finish" to="showAlternateRoute"/>
    
    
    
    类似地,在SubFlow.xml中:

    <end-state id="finish" >
     <output name="actProfile" value="actProfile" type="com.mycompany.AcctProfile" />
    </end-state>
    

    这也正是我的问题所在。在我的例子中,还需要在子流的视图状态中添加model属性。
    <subflow-state id="createAccountSubFlow" subflow="createAccountSubFlow">
        <input name="actProfile" value="actProfile" type="com.mycompany.ActProfile" />  
        <output name="actProfile" value="actProfile" type="com.mycompany.ActProfile" /> 
        <transition on="finish" to="showAlternateRoute"/>
    
    <end-state id="finish" >
     <output name="actProfile" value="actProfile" type="com.mycompany.AcctProfile" />
    </end-state>