簡體   English   中英

帶有JSF 2的Spring Webflow 2.0 - 動態流是否可行?

[英]Spring Webflow 2.0 with JSF 2 - Is a dynamic Flow possible?

我是Spring Webflow的新手,所以我對一個(或更多)Flow有一個問題。

我想在JSF中構建一些facelet,並在ui-include中創建一個可以具有不同ui-params的頁面,具體取決於我稍后要在流程中添加的內容。

示例application.xhtml:

`<ui:include src="start.xhtml">
<ui:param name="page1" value="page1.xhtml" />
<ui:param name="page2" value="page2.xhtml" />
<!-- page 3 should be ignored -->
<!-- <ui:param name="page3" value="page3.xhtml" /> -->
<ui:param name="page4" value="page4.xhtml" />
</ui:include>`

現在我有我想要檢查的start-flow.xml,其中ui:params頁面得到了。 但我不知道怎么做,我在網上找不到類似的東西。 所以我想,這可能是錯誤的方法:-)

誰能幫我嗎?

我的目標是擁有一個流程(獨立於硬編碼的facelets,所以我可以查看ui的列表:params我擁有的facelets並使用它們,如:

`<view-state id="start" view="${flowScope.allViews[0]}">
<!-- assuming every facelet has a next-action -->
<transition on="next" to="${flowScope.allViews[1]}" />
</view-state>`

很確定你不能在Spring Webflow中獲得JSF includes / params的列表。

你可以得到的最接近的東西是抓住FacesContext並嘗試通過它們的id找到已知的組件:

 boolean haveComponent1 = (FacesContext.getCurrentInstance().getViewRoot().findComponent("component1") != null);

假設您知道Webflow中包含頁面中的組件ID,您可以執行以下操作:

<decision-state id="doSomSink">
    <on-entry>
        <evaluate expression='FacesContext.getCurrentInstance().getViewRoot().findComponent("component1") != null)'  result="flowScope.haveComponent1" result-type="bool"></evaluate>
    </on-entry>
    <if test="flowScope.haveComponent1" then="doIt" else="doNothing"/>
</decision-state>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM