我從主流調用子流。我已經能夠將對象ShareHolderProfile
從MainFlow傳遞給SubFlow。但是,我不確定這個相同的對象是不是被傳回給MainFlow,或者我沒有在我的JSP中正確訪問它。這是我如何做的。Spring Flow:從主WebFlow和子流之間來回傳遞對象
MainFlow.xml
<?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-2.0.xsd"
start-state="retriveAccount">
<var name="acctProfile" class="com.abc.xyz.account.ShareHolderProfile"/>
<view-state id="retriveAccount" view="AccountView">
<transition on="Success" to="createAccountSubFlow"/>
</view-state>
<subflow-state id="createAccountSubFlow" subflow="createAccountSubFlow">
<input name="acctProfile" value="acctProfile"/>
<transition on="finish" to="showAlternateRoute"/>
</subflow-state>
<view-state id="showAlternateRoute" view="showAlternateView" model="acctProfile">
<on-entry>
<evaluate someExpression result="viewScope.SomeValue"/>
</on-entry>
<transition on="viewAction" to="accountDetails"/>
</view-state>
SubFlow.xml
<?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-2.0.xsd"
start-state="showAccount">
<input name="acctProfile" />
<view-state id="showAccount" view="randomView" model="acctProfile">
<on-entry>
<evaluate expression="SomExpression"/>
</on-entry>
<transition on="SomeEvent" to="NextState"/>
</view-state>
<view-state id="NextState" view="SomeRandomView" model="acctProfile">
<on-entry>
<evaluate expression="controller.Method(acctProfile)" result="viewScope.profileForm"/>
</on-entry>
<transition on="viewResult" to="finish"/>
</view-state>
<end-state id="finish" />
現在,在大多數情況下,在應用程序的流程正常工作。然而,問題是我一直試圖從我的jsp中的一個acctProfile訪問一些屬性(成員變量)。類似於 - acctProfile.FirstName
但是,我無法做到這一點。 acctProfile對象是不是從subFlow傳遞給Mainflow,還是我在JSP中使用不正確?請指教。
在此先感謝
這正是我的問題了。在我的情況下,還需要在子流的視圖狀態中添加模型屬性。 –