|
Basic JSF Features

|
|
Example event descriptors entries are shown in the table below.
NAVIGATION-PATH DESCRIPTORS |
id |
handler |
result |
from-page-id |
path |
security |
options |
description |
| 1 |
{wizard.next} |
success |
! |
/Confirm.jsp |
admin |
redirect |
|
The destination of the data captured by the navigation result descriptor is the navigation-rule element inside the face configuration XML.
This configuration allows specifying navigation rules for a page or set of pages. It uses wild card for specification of pages or subset of pages within a directory.
The absence of a from page would imply that the rule applies to all pages.
<navigation-rule>
<from-view-id>pages/*</from-view-id>
<navigation case>
.
.
</navigation-rule>
Within the navigation rule are navigation cases, which allow specifying actions and results to match, in following a navigation path.
<navigation case>
<description>Next page presented on successful entry</description>
<from-action>#{wizard.nextPage}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>/Confirm.jsp</to-view-id>
<redirect/>
</navigation case>
There are correspondences between dWebSpec descriptor attributes and these configuration entries, as shown below.
For further discussion follow the links for the descriptor attributes listed above.
|
SEAM Enhancements
The primary addition provided by Seam for navigation-path implementation, is the alternate and more robust means of capturing the navigational rules.
A sample specification is shown below.
NAVIGATION-PATH DESCRIPTORS |
id |
handler |
result |
from-page-id |
path |
security |
options |
description |
| 1 |
{category.save} |
success |
! |
pages/confirm.xhtml |
admin |
redirect |
|
Using standard JSF configuration the specifications would be accommodated to an extent; areas like security and the use of expression with or in place of string result are not accommodated.
The implementation with Seam would be as shown below.
<page page-id="page.xhtml">
<navigation from-action="#{categories.save}">
<rule if-outcome="success" if="#{s:hasRole='admin'}">
<redirect view-id="pages/confirm.xhtml"
</rule>
</navigation>
</page>
The transformation is analyzed below.
Descriptor Attribute |
Seams Configuration |
| from-page-id |
This is entered into view-id attribute of the page element. |
| handler |
The from-action attribute of the navigation element. |
| result |
if-outcome attribute of the rule element |
| security |
if attribute of the rule element. This attribute would also be used if the result is specified as an expression. |
| options |
The only configurable option is redirect. This would imply that the destination view would use a redirect element. In the absence of this option, it is the render element that would be used. |
| path |
The view-id attribute of the render or redirect elements. |
| Parameters (Note: the descriptor does not have place holder for parameters. A navigation-path id could be entered as a parent to a parameters descriptor.) |
This is only relevant for options redirect.
One or multiple param element nested within the redirect element, would carry the parameters. |
Conversation and Navigation
There are options that could be specified for the resulting navigation-path.These are listed in the table below.
| call-type | Implementation | description |
| conversation:begin | <begin-conversation/> | Starts a conversation |
| conversation:beginNested | <begin-conversation nest="true"/> | Starts a conversation nested in another conversation |
| conversation:end | <end-conversation/> | Ends a conversation |
| conversation:join | <begin-conversation join="true"/> | Joins an existing converstation |
An example specification is shown below.
NAVIGATION-PATH DESCRIPTORS |
id |
handler |
result |
from-page-id |
path |
security |
options |
description |
| 1 |
{category.save} |
success |
! |
pages/confirm.xhtml |
|
conversation:begin,redirect |
|
For some options, the order of the options matter. For example, the implication could be end before or end after redirect
The implementation would be as shown below.
<page page-id="page.xhtml">
<navigation from-action="#{categories.save}">
<rule if-outcome="success">
<begin-conversation/>
<redirect view-id="pages/confirm.xhtml"
</rule>
</navigation>
</page>
Because the Seam conversation mechanism keeps track of associated view-id used, it could provide some navigation consequence.
Generally, there are means of controlling the conversation life cycle, these are captured in the event descriptor.
The concern here is the navigational impact. the first issue of note is that some of the entries in the event descriptor, could have navigational impact, without reflecting
these in the navigation-path. This is because these navigational rules are deciphered in the controller, and there are nothing to reflect declaratively. Because these paths are
derive at runtime, like the last view-id used by the conversation or its parent.
Examples of is shown below.
EVENT DESCRIPTORS |
id |
event-source |
parameters |
handler |
handler-class |
security |
call-type |
| 8 |
forms[category].elements[cancel] |
|
{conversation.endAndRedirect} |
|
|
|
<h:commandButton id="cancel" value="Cancel" action="#{conversation.endAndRedirect}"/>
A full list of these conversation/navigation methods is shown in the list below.
| Method | Description |
| redirect | Redirect to the last known view-id for the conversation |
| endAndRedirect | End conversation and then redirect to the last known view-id for the conversation |
| redirectToParent | Switch to parent converstaion, and redirect to the last known view-id for the parent conversation |
| redirectToRoot | Switch to root converstaion, and redirect to the last known view-id for the root conversation |
|