The preference Element"
From Documentation
Maya001122 (talk | contribs) m |
m (correct highlight (via JWB)) |
||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{ZKConfigurationReferencePageHeader}} | {{ZKConfigurationReferencePageHeader}} | ||
− | + | '''Syntax:''' | |
<preference> | <preference> | ||
<name>''any name''</name> | <name>''any name''</name> | ||
<value>''any value''</value> | <value>''any value''</value> | ||
</preference> | </preference> | ||
− | |||
− | Specify a preference with the < | + | [Optional] |
+ | |||
+ | Specify a preference with the <code>preference</code> 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 <code>com.friend.some.another</code>. | ||
The preferences are application-level. They are shared by a single ZK application (<javadoc type="interface">org.zkoss.zk.ui.WebApp</javadoc>). | The preferences are application-level. They are shared by a single ZK application (<javadoc type="interface">org.zkoss.zk.ui.WebApp</javadoc>). | ||
− | They can then be retrieved back by calling the < | + | They can then be retrieved back by calling the <code>getPreference</code> method of the <javadoc>org.zkoss.zk.ui.util.Configuration</javadoc> class. Notice that each Web application has one configuration, which can be found by the use of <code>getConfiguration</code> method of the <javadoc type="interface">org.zkoss.zk.ui.WebApp</javadoc> interface. |
<source lang="java" > | <source lang="java" > | ||
Line 20: | Line 21: | ||
} | } | ||
</source> | </source> | ||
+ | |||
+ | For a complete list of supported preferences, please refer to [[ZK Configuration Reference/zk.xml/The Preferences|the Preferences section]]. | ||
==Version History== | ==Version History== |
Latest revision as of 10:33, 19 January 2022
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 the 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 supported preferences, please refer to the Preferences section.
Version History
Version | Date | Content |
---|---|---|