JSF Standard Managed Bean Annotations
The JSR-344 JavaServer Faces standard defines a set of annotations in the javax.faces.bean package that can be used to declare and configure managed beans directly in a Java class. This is an alternative to declaring the same information in the WEB-INF/faces-config.xml file of your Composite Application Framework (CAF) application. Pertinent code is highlighted in bold.
Example:
package caf.war.testapp1.test1;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
/**
* Sample that demonstrates using the ManagedBean annotations
* to declare a managed bean
*/
@ManagedBean(name = "TestBean")
@SessionScoped
public class TestBean extends com.webmethods.caf.faces.bean.BaseFacesSessionBean {
/**
* Override this method to release any resources associated with this
session.
* Please note, the FacesContext is not valid for this function.
*/
protected void release() {
};
}
Related Topics