Here, for example, is a snippet of the faces-config.xml file for the sample application.
In this example, the Spring bean named itemSearchService is configured as a managed property of the JSF managed bean class ItemSearchHandler. A JSF managed bean with session scope is stored in the session. This means that the bean's properties stay alive for the life of the HTTP session.
The itemSearchService is defined as a Spring bean, ItemSearchService, in the spring configuration resource file WEB-INF/applicationContext.xml. Here is a snippet of that file,
The element itemSearchService refers to the setItemSearchService() method in ItemController. In response, the Spring root WebApplicationContext injects the catalogService Spring bean into the catalogService property of the JSF managed bean ItemController. Here is a snippet of the ItemController source file:
The searchItems() method wraps a List of item objects returned from the itemSearchService in a DataModel. UIData supports data binding to a collection of data objects represented by a DataModel instance. The data collection underlying a DataModel instance is modeled as a collection of row objects that can be accessed by a row index. The APIs provide mechanisms to position to a specified row index, and to retrieve an object that represents the data that corresponds to the current row index.
Final configuration for the web.xml is as follows.
Thats all about the configuration of Spring and JSF using DelegatingVariableResolver .
No comments:
Post a Comment