In JSF2, I was wondering how I could navigate to a page automatically based on a value - automatically meaning, without having to click a button or commandLink?
I have a composite component with parameters (composite:attribute) and when this composite component is started, I would like user to be automatically navigated (without user having to press a button or click on a command link) to a certain page, based on one of the composite:attributes. How could I do this?
Essentially, is there a way to get a JSF .xhtml page to output an action value automatically - so that this value could be used for navigating to a specific page?
My composite component's interface looks like this: (I have simplified things here to get the idea across)
<composite:interface>
<composite:attribute name="showTable2" type="Boolean"
required="true" shortDescription="Show the second table?" />
</composite:interface>
And I have a navigation rule like this, where the user is taken to a page based on the input composite:attribute. The thing is that, user needs to be taken to one of the two pages in the navigation rule because that page is the one that user would get to see first. So, no button / commandLink to use for executing this navigation rule.
<navigation-rule>
<from-view-id>/index.xhtml</from-view-id>
<navigation-case>
<from-outcome>showTable2</from-outcome>
<to-view-id>/twoTables.xhtml</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>dontShowTable2</from-outcome>
<to-view-id>/oneTable.xhtml</to-view-id>
</navigation-case>
So, the input composite:attribute needs to be converted into an outcome value and be executed so that my navigation rule can be executed.
Thanks a lot!