3
votes

I´m new to Spring Webflow, so I have a Question about a (or more) Flows.

I want to build a few facelets in JSF and one start Page that can have different ui-params in an ui-include, depending on what i want to add in the flow later.

Example 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>`

Now i have my start-flow.xml where i want to check, which ui:params the page got. But i don´t knwo how to to that, and i couldn´t find anything similar on the web. so i assume, this might be the wrong way to do so :-)

Can anyone help me out?

My goal is to have a flow (independent from hardcoded facelets, so i can check a list of ui:params what facelets i have and to use them, like:

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

1 Answers

0
votes

Pretty sure you cant just get a list of JSF includes/params in Spring Webflow.

The closest thing you can get to it is to grab FacesContext and try to locate known components by their ids:

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

Assuming you know component IDs in included pages in webflow you can do something like:

<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>