|
Binding the Bean to the JSP Page
JSF uses an XML file called faces-config.xml to manage the configuration of beans so that the beans' methods are available to components in the page.
The code for the faces-config.xml file is as follows:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd"> <faces-config xmlns="http://java.sun.com/JSF/Configuration"> <managed-bean> <managed-bean-name>timeZoneBean</managed-bean-name> <managed-bean-class>com.icesoft.tutorial.TimeZoneBean</managed-bean-class> <managed-bean-scope>session</managed-bean-scope> </managed-bean> </faces-config>The entry bean is given a name by which it can be referred to in the JSP page and the name is also associated with a Java class so that it can be instantiated as required. The bean is also given a scope to indicate how the bean can be accessed.
Copyright 2005-2009. ICEsoft Technologies, Inc. |