The timeout-message Element"
m |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 6: | Line 6: | ||
[Optional] | [Optional] | ||
[Since 5.0.5] | [Since 5.0.5] | ||
− | [Default: <i>a message defined in [ | + | [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 timeout-uri element is <i>not</i> specified. | 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. | ||
Line 13: | Line 13: | ||
<session-config> | <session-config> | ||
<device-type>ajax</device-type> | <device-type>ajax</device-type> | ||
− | <timeout-message>Session timeout. Please reload.</timeout- | + | <timeout-message>Session timeout. Please reload.</timeout-message> |
</session-config> | </session-config> | ||
</source> | </source> | ||
Line 26: | Line 26: | ||
<session-config> | <session-config> | ||
<device-type>ajax</device-type> | <device-type>ajax</device-type> | ||
− | <timeout-message>label:timeout</timeout- | + | <timeout-message>label:timeout</timeout-message> |
</session-config> | </session-config> | ||
</source> | </source> | ||
− | Then, you have to prepare the | + | 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"> | ||
− | # | + | #zk-label.properties |
timeout={ | timeout={ | ||
Session timeout. | Session timeout. | ||
Line 49: | Line 49: | ||
<session-config> | <session-config> | ||
<device-type>ajax</device-type> | <device-type>ajax</device-type> | ||
− | <timeout-message>script:foo.timeout('Session Timeout')</timeout- | + | <timeout-message>script:foo.timeout('Session Timeout')</timeout-message> |
</session-config> | </session-config> | ||
</source> | </source> |
Revision as of 04:07, 10 February 2012
Syntax:
<timeout-message>a_message</timeout-message>
[Optional] [Since 5.0.5] [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 element 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 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 script:
.
For example, 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.
Version History
Version | Date | Content |
---|---|---|
5.0.5 | October 2010 | The support of Custom Message and JavaScript was introduced. |