The preference Element"

From Documentation
m
m
Line 22: Line 22:
 
</source>
 
</source>
  
For a complete list of built-in preferences, please refer to [[ZK Configuration Reference/zk.xml/The Preferences|the preferences section]].
+
For a complete list of built-in preferences, please refer to [[ZK Configuration Reference/zk.xml/The Preferences|the Preferences section]].
  
 
==Version History==
 
==Version History==

Revision as of 10:55, 10 February 2011


The preference Element


Syntax:

<preference>
    <name>any name</name>
    <value>any value</value>
</preference>
[Optional]

Specify a preference with the preference element depicted above. The name and value are application specific and you can specify whatever value you like. Mupltie To avoid name conflict, it is suggested to prefix the name with your domain name, such as com.friend.some.another.

The preferences are application-level. They are shared by a single ZK application (WebApp).

They can then be retrieved back by calling the getPreference method of the Configuration class. Notice that each Web application has one configuration, which can be found by use of getConfiguration method of the WebApp interface.

 String value = webApp.getConfiguration().getPreference("org.zkoss.name", null);
 if (value != null) {
     ...
 }

For a complete list of built-in preferences, please refer to the Preferences section.

Version History

Version Date Content
     



Last Update : 2011/02/10

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