Programming Tips"

From Documentation
Line 2: Line 2:
  
 
=Objects Referenced by UI Must Serializable=
 
=Objects Referenced by UI Must Serializable=
 +
 +
Objects that are referenced by an UI object, such as component and page, have to be serializable. Otherwise, they might have no value after de-serialized, or causes an exception (depending how it is used).
 +
 
==Attributes of UI Objects==
 
==Attributes of UI Objects==
 +
 +
If the value of an attribute is not serializable, it will be ignored. Thus, it will become null after de-serialized. Thus, it is better to make them all serializable (such as implementing java.io.Serializable), or handle the serialization manually (refer to the [[##Clustering_Listeners|Clustering Listeners]] section below) .
 +
 
==zscript==
 
==zscript==
==Listeners==
+
 
 +
It is OK, though not recommended, to use zscript in a clustering environment, but there are some limitations.
 +
 
 +
*BeanShell's function is not serializable. For example, the following won't work:
 +
<source lang="xml">
 +
void foo() {
 +
}
 +
</source>
 +
 
 +
*The values of variables must be serializable
 +
 
 +
Notice that it is not recommended to use zscript in the clustering environment. After all, the [[ZK Developer's Reference/Performance Tips/Use Compiled Java Codes|performance of BeanShell]] is not good.
 +
 
 +
==Event Listeners==
 +
 
 +
Event listeners have to be serializable. Otherwise, it will be ignored after serialization.
 +
 
 
==Data Models==
 
==Data Models==
 +
 +
The data model, such as <javadoc>org.zkoss.zul.ListModel</javadoc> and <javadoc>org.zkoss.zul.ChartModel</javadoc>, have to be serializable. Otherwise, the UI object (such as grid) won't behave correctly. The implementations provided by ZK are serializable. However, the items to be stored in the data models have to be serializable too.
 +
 
==Composers==
 
==Composers==
 +
 
=Clustering Listeners=
 
=Clustering Listeners=
 
==Activation Listener for Non-Serializable Objects==
 
==Activation Listener for Non-Serializable Objects==

Revision as of 04:30, 18 November 2010


Programming Tips


Objects Referenced by UI Must Serializable

Objects that are referenced by an UI object, such as component and page, have to be serializable. Otherwise, they might have no value after de-serialized, or causes an exception (depending how it is used).

Attributes of UI Objects

If the value of an attribute is not serializable, it will be ignored. Thus, it will become null after de-serialized. Thus, it is better to make them all serializable (such as implementing java.io.Serializable), or handle the serialization manually (refer to the Clustering Listeners section below) .

zscript

It is OK, though not recommended, to use zscript in a clustering environment, but there are some limitations.

  • BeanShell's function is not serializable. For example, the following won't work:
void foo() {
}
  • The values of variables must be serializable

Notice that it is not recommended to use zscript in the clustering environment. After all, the performance of BeanShell is not good.

Event Listeners

Event listeners have to be serializable. Otherwise, it will be ignored after serialization.

Data Models

The data model, such as ListModel and ChartModel, have to be serializable. Otherwise, the UI object (such as grid) won't behave correctly. The implementations provided by ZK are serializable. However, the items to be stored in the data models have to be serializable too.

Composers

Clustering Listeners

Activation Listener for Non-Serializable Objects

Serialization Listeners for Customizing Serialization

Working Thread Cannot Last Two or More Requests

Version History

Last Update : 2010/11/18


Version Date Content
     



Last Update : 2010/11/18

Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License.