first_page the funky knowledge base
personal notes from way, _way_ back and maybe today

JavaServer Faces in Action Notes: Chapter 2; JSF Fundamentals; 2.1.7 Messages; 2.1.8 Navigation

2.1.7 Messages

Messages are communications with the user. Other UI components can be associated with the HtmlMessages components in a declarative way like this:

<h:message
    id="errors"
    for="helloInput"
    style="color:red;display:block;" />

They can also be used in Java code for, say, informational messages in an action listener method.

2.1.8 Navigation

"Faces has a pretty elegant navigation system. The navigation handler is responsible for deciding what page to load based on the logical outcome of an action method." The following sample shows a "navigation rule" and associated navigation cases:

<navigation-rule>
    <description>Navigation from the hello page.</description>
    <from-view-id>/hello.jsp</from-view-id>
    <navigation-case>
        <from-outcome>success</from-outcome>
        <to-view-id>/goodbye.jsp</to-view-id>
    </navigation-case>
</navigation-rule>

"This is a handy feature of JSF that should look familiar if you've used frameworks like Struts... changes can be made in a central location [faces-config.xml] instead of across several pages.

mod date: 2007-03-20T22:54:00.000Z