3

我是 Spring Webflow 的新手,所以我有一个关于(或更多)流的问题。

我想在 JSF 中构建一些 facelets 和一个起始页面,它可以在 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>`
4

1 回答 1

0

很确定你不能只在 Spring Webflow 中获得 JSF 包含/参数的列表。

最接近它的方法是获取 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>
于 2013-02-01T20:58:45.613 回答