JSF – faces-config.xml Description
Defines the backing beans :
Name used in EL in template
Scope controlled (request, session, etc.)
Defines navigation rules :
- Based on views
Where from (view)
Which outcome (id)
Where to go (view)
- Can match outcomes using wildcards
JSF – faces-config Snapshot
<faces-config>
<navigation-rule>
<from-view-id>/jsf/JsfItems.jsp</from-view-id>
<navigation-case>
<from-outcome>newItem</from-outcome>
<to-view-id>/jsf/JsfAddItem.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>*</from-outcome>
<to-view-id>/jsf/JsfItems.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<managed-bean>
<managed-bean-name>JsfBean</managed-bean-name>
<managed-bean-class>org.example.jsf.JsfBean</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
<managed-property>
<property-name>logic</property-name>
<value>#{someLogicBean}</value>
</managed-property>
</managed-bean>
</faces-config>
JSF – Backing beans
Typical bean with getters and setters and additional methods to handle actions
- Store data needed for processing the user actions using setters
- Retrieve data using getters and methods
- Process actions using methods
JSF – Backing bean Snapshot
public class Second extends PageCodeBase {private Integer id;
public String doButton1Action() {
// Type Java code that runs when the component is clicked
// TODO: Return outcome that corresponds to a navigation rule
return “back”;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}}

0 Comments.