The timeout-message Element"

From Documentation
(Created page with '{{ZKConfigurationReferencePageHeader}} == The timeout-message Element == [Optional] [Since 5.0.5] [Default: <i>a message defined in [http://docs.zkoss.org/wiki/Msgzk.properti…')
 
 
(10 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{ZKConfigurationReferencePageHeader}}
 
{{ZKConfigurationReferencePageHeader}}
 +
{{versionSince| 5.0.5}}
 +
 +
'''Syntax:'''
 +
<timeout-message>''a_message''</timeout-message>
  
== The timeout-message Element ==
 
 
  [Optional]
 
  [Optional]
[Since 5.0.5]
 
[Default: <i>a message defined in [http://docs.zkoss.org/wiki/Msgzk.properties MZk.UPDATE_OBSOLETE_PAGE]</i>]
 
  
It specifies the message to show when the session is timeout. Notice that it is used only if the timeout-uri element is <i>not</i> specified.
+
[Default: <i>a message called <javadoc method="UPDATE_OBSOLETE_PAGE">org.zkoss.zk.mesg.MZk</javadoc> defined in [[ZK Messages/English/msgzk.properties|msgzk.properties]]</i>]
 +
 
 +
It specifies the message to show when the session is timeout. Notice that it is used only if the <code><timeout-uri></code> is '''not''' specified.
  
 
<source lang="xml">
 
<source lang="xml">
 
<session-config>
 
<session-config>
 
<device-type>ajax</device-type>
 
<device-type>ajax</device-type>
<timeout-message>Session timeout. Please reload.</timeout-timeout>
+
<timeout-message>Session timeout. Please reload.</timeout-message>
 
</session-config>
 
</session-config>
 
</source>
 
</source>
  
=== Internationalization ===
+
For more information, please refer to [[ZK Developer's Reference/UI Patterns/Session Timeout Management]].
 +
 
 +
== Internationalization ==
  
 
If you want to specify a Locale-dependent message, you could specify the key and prefix it with <code>label:</code> as follows.
 
If you want to specify a Locale-dependent message, you could specify the key and prefix it with <code>label:</code> as follows.
Line 22: Line 27:
 
<session-config>
 
<session-config>
 
<device-type>ajax</device-type>
 
<device-type>ajax</device-type>
<timeout-message>label:timeout</timeout-timeout>
+
<timeout-message>label:timeout</timeout-message>
 
</session-config>
 
</session-config>
 
</source>
 
</source>
  
Then, you have to prepare the i3-label properties files as described in [[ZK_Developer%27s_Reference/Internationalization/Labels|ZK Developer's Reference]].
+
Then, you have to prepare the zk-label properties files as described in [[ZK_Developer%27s_Reference/Internationalization/Labels|ZK Developer's Reference]].
  
 
<source lang="text">
 
<source lang="text">
#i3-label.properties
+
#zk-label.properties
 
timeout={
 
timeout={
 
Session timeout.
 
Session timeout.
Line 36: Line 41:
 
</source>
 
</source>
  
=== JavaScript ===
+
== JavaScript ==
  
Instead of sending the message, you could provide the JavaScript code for the client to evaluate. To specify the JavaScript code, you have to prefix it with <code>script:</code>.
+
Instead of specifying a message, you can provide a JavaScript code for the client to evaluate. To specify a JavaScript code, you have to prefix it with <code>script:</code>.
  
For example, you have a function called <tt>foo.timeout</tt> to handle the timeout effect, then you could configure <tt>WEB-INF/zk.xml</tt> as follows.
+
For example, if you have a function called <code>foo.timeout</code> to handle the timeout effect, then you could configure <code>WEB-INF/zk.xml</code> as follows.
  
 
<source lang="xml">
 
<source lang="xml">
 
<session-config>
 
<session-config>
 
<device-type>ajax</device-type>
 
<device-type>ajax</device-type>
<timeout-message>script:foo.timeout('Session Timeout')</timeout-timeout>
+
<timeout-message>script:foo.timeout('Session Timeout')</timeout-message>
 
</session-config>
 
</session-config>
 
</source>
 
</source>
Line 51: Line 56:
 
The code depends on the client. For Ajax devices, it has to be JavaScript.
 
The code depends on the client. For Ajax devices, it has to be JavaScript.
  
=Version History=
 
{{LastUpdated}}
 
{| border='1px' | width="100%"
 
! Version !! Date !! Content
 
|-
 
| &nbsp;
 
| &nbsp;
 
| &nbsp;
 
|}
 
  
 
{{ZKConfigurationReferencePageFooter}}
 
{{ZKConfigurationReferencePageFooter}}

Latest revision as of 06:31, 22 January 2024


The timeout-message Element


Since 5.0.5

Syntax:

<timeout-message>a_message</timeout-message>
[Optional]
[Default: a message called MZk.UPDATE_OBSOLETE_PAGE defined in msgzk.properties]

It specifies the message to show when the session is timeout. Notice that it is used only if the <timeout-uri> is not specified.

<session-config>
	<device-type>ajax</device-type>
	<timeout-message>Session timeout. Please reload.</timeout-message>
</session-config>

For more information, please refer to ZK Developer's Reference/UI Patterns/Session Timeout Management.

Internationalization

If you want to specify a Locale-dependent message, you could specify the key and prefix it with label: as follows.

<session-config>
	<device-type>ajax</device-type>
	<timeout-message>label:timeout</timeout-message>
</session-config>

Then, you have to prepare the zk-label properties files as described in ZK Developer's Reference.

#zk-label.properties
timeout={
Session timeout.
(multi-line is allowed)
}

JavaScript

Instead of specifying a message, you can provide a JavaScript code for the client to evaluate. To specify a JavaScript code, you have to prefix it with script:.

For example, if you have a function called foo.timeout to handle the timeout effect, then you could configure WEB-INF/zk.xml as follows.

<session-config>
	<device-type>ajax</device-type>
	<timeout-message>script:foo.timeout('Session Timeout')</timeout-message>
</session-config>

The code depends on the client. For Ajax devices, it has to be JavaScript.



Last Update : 2024/01/22

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