Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/373.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 带JSF2的SpringWebflow2.0——动态流可能吗?_Java_Spring_Jsf_Jsf 2_Spring Webflow 2 - Fatal编程技术网

Java 带JSF2的SpringWebflow2.0——动态流可能吗?

Java 带JSF2的SpringWebflow2.0——动态流可能吗?,java,spring,jsf,jsf-2,spring-webflow-2,Java,Spring,Jsf,Jsf 2,Spring Webflow 2,我是SpringWebFlow的新手,所以我有一个关于一个(或多个)流的问题 我想在JSF中构建几个Facelet和一个起始页,在ui包含中可以有不同的ui参数,这取决于我以后要在流中添加的内容 示例application.xhtml: `<ui:include src="start.xhtml"> <ui:param name="page1" value="page1.xhtml" /> <ui:param name="page2" value="page2.xh

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

我想在JSF中构建几个Facelet和一个起始页,在ui包含中可以有不同的ui参数,这取决于我以后要在流中添加的内容

示例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>`
`
`

可以肯定的是,您不能在SpringWebflow中只获得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>