Faces Client: Configure Client Data
Overview
Client Data is derived from a Page Data component. The Client Data is formatted into JavaScript objects and included in the JSP that is sent to the browser. Sometimes you may want to configure the Client Data to achieve a better performance. You can prune the data to eliminate attributes that are not used, add client attributes, and regenerate client data when underlying data beans get changed. The Configure Client Data dialog provides these functions.
You access the Configure Client Data dialog from the Client Data view. Highlight the Client Data Object, right-click and select Configure. In the Configure Client Data dialog, there are two tabs: Basic and Advanced. In the Basic tab, you can prune the Client Data and add client attributes. The Client data model name is optional in the Basic tab. Specify this field when you want to share a Client Data Object between portlets. Use the Primary key check box to mark a property in a bean as part of a primary key. Any property with a cardinality of 1 or less is set to be part of primary key by default. Marking the primary key properties correctly will achieve better performance.
Primary key limitation
You cannot use attributes of type java.util.Date as the primary key when the target server is WebSphere Application Server 5.1.
Add a Client Data attribute
In the Basic tab of the Configure Client Data dialog, you can add a Client Data attribute by pressing Add client attribute. At the bottom of the dialog, enter the following:
- Type
- This is the data type, such as integer, float, boolean, etc.
- Name
- This is the name of the attribute.
- Expression
- This is either a value or an expression.
Note: Adding Client Data attributes may affect performance because the supplied expression is invoked each time the client attribute is referenced to ensure that the latest values are used.
Synchronization of page data with client side data
Client Data can be synchronized with Page Data, which represents the data on the server, when the user submits the page back to the server. This synchronization is enabled by default. The automatic update is supported for JavaBeans, Relational Records Lists, Relational Records, and EGL records. If you want to write your own diff handlers to synchronize the Client Data and the Page Data, you can turn this feature off from the Client Data configurator by unchecking Exclude changes to this element when synchronizing on the Basic tab of the Configure Client Data dialog.
Pruning a data graph
You can prune a data graph by unchecking the check box next to a node in the Basic tab.
Removing and Regenerating Client Data
In the Advanced tab of the Configure Client Data dialog, you have several buttons for loading emap source, regenerating from server side data, and removing client data from project.