page"

From Documentation
 
(19 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{ZKZUMLReferencePageHeader}}
+
{{ZUMLReferencePageHeader}}
  
 
__TOC__
 
__TOC__
  
<source lang="xml" >
+
'''Syntax:'''
  <?page [id="..."] [title="..."] [style="..."] [cacheable="false|true"]
+
  <?page [id="..."] [title="..."] [style="..."] [cacheable="'''false'''|true"]
 
   [language="xul/html"] [zscriptLanguage="Java"]
 
   [language="xul/html"] [zscriptLanguage="Java"]
 
   [contentType="text/html;charset=UTF-8"]
 
   [contentType="text/html;charset=UTF-8"]
Line 11: Line 11:
 
   [xml="version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;"]
 
   [xml="version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;"]
 
   [complete="true|'''false'''"]
 
   [complete="true|'''false'''"]
   [automaticTimeout="true|false"]?>
+
   [automaticTimeout="true|'''false'''"]
</source>
+
  [viewport="width=device-width,initial-scale=1.0"]?>
  
It specifies how a page shall be handled. The <tt>id</tt> and <tt>title</tt> arguments are the two most important ones.
+
It specifies how a page should be handled. The <code>id</code> and <code>title</code> arguments are the two most important ones.
  
== automaticTimeout ==
+
= automaticTimeout =
  
 
  [Optional]
 
  [Optional]
Line 22: Line 22:
 
  [Default: the applicatioin default]
 
  [Default: the applicatioin default]
  
It specifies whether to automatically redirect to the timeout URI. If false, it means a page will be redirected to the timeout URI, when the use takes some action after timeout. In other words, nothing happens if the user does nothing.
+
It specifies whether to automatically redirect to the timeout URI. If it is false, a page will be redirected to the timeout URI when the user takes some action after timeout. In other words, nothing would happen if the user does nothing.
  
If omitted, whether to automatically timeout depends on the application's configuration. Please refer [http://books.zkoss.org/wiki/ZK_Configuration_Reference/zk.xml/The_session-config_Element here]
+
If omitted, whether to automatically timeout depends on the application's configuration. Please refer to [[ZK_Configuration_Reference/zk.xml/The_session-config_Element|ZK Configuration Reference: session-config]].
  
 
A typical use is to turn off the automatic timeout for the timeout page (otherwise, it will be reloaded again after the session is timeout again). For example,
 
A typical use is to turn off the automatic timeout for the timeout page (otherwise, it will be reloaded again after the session is timeout again). For example,
Line 38: Line 38:
 
Of course, you don't need to do anything, if the timeout page is not a ZUML page.
 
Of course, you don't need to do anything, if the timeout page is not a ZUML page.
  
== cacheable ==
+
= cacheable =
  
 
  [Optional]
 
  [Optional]
Line 45: Line 45:
 
It specifies whether the client can cache the output.
 
It specifies whether the client can cache the output.
  
'''Note''': Browsers, such as Firefox and IE, don't handle the cache of DHTML correctly, so it is not safe to specify <tt>cacheable</tt> with true for Ajax devices.
+
'''Note''': Browsers, such as Firefox and IE, don't handle the cache of DHTML correctly, so it is not safe to specify <code>cacheable</code> with true for Ajax devices.
  
== complete ==
+
= complete =
  
 
<source lang="xml" >
 
<source lang="xml" >
Line 53: Line 53:
 
</source>
 
</source>
  
It specifies that this page is a complete page. By complete we mean the page has everything that the client expects. For example, if the client is a HTML browser, then a complete page will generate all necessary HTML tags, such as <tt><html></tt>, <tt><head></tt> and <tt><body></tt>.
+
It specifies that this page is a complete page. By complete we mean the page has everything that the client expects. For example, if the client is a HTML browser, then a complete page will generate all the necessary HTML tags, such as <code><html></code>, <code><head></code> and <code><body></code>.
  
By default (false), a ZK page is assumed to be complete ''if and only if'' it is ''not'' included by other page. In other words, if a ZK page is included by other page, ZK will generate <tt>< div></tt> (if the client is a HTML browser) to enclose the output of the (incomplete) ZK page.<div>
+
By default (false), a ZK page is assumed to be complete ''if and only if'' it is ''not'' included by other page. In other words, if a ZK page is included by other page, ZK will generate <code>< div></code> (if the client is a HTML browser) to enclose the output of the (incomplete) ZK page.<div>
  
If you have a ZK page that contains a complete HTML page and is included by other page, you have to specify <tt>true</tt> for this option. For example, the includer is nothing but including another page:
+
If you have a ZK page that contains a complete HTML page and is included by other pages, you have to specify <code>true</code> for this option. For example, the includer is nothing but it includes another page:
  
 
<source lang="xml" >
 
<source lang="xml" >
Line 79: Line 79:
 
</source>
 
</source>
  
== contentType ==
+
= contentType =
  
 
  [Optional]
 
  [Optional]
 
  [Default: ''depends on the device'']
 
  [Default: ''depends on the device'']
  
It specifies the content type. If not specified, it depends on the device. For Ajax devices, it is <tt>text/html;charset=UTF-8</tt>. For XML and MIL devices, it is <tt>text/xml;charset=UTF-8</tt>.
+
It specifies the content type. If not specified, it depends on the device. For Ajax devices, it is <code>text/html;charset=UTF-8</code>. For XML and MIL devices, it is <code>text/xml;charset=UTF-8</code>.
  
 
Application developers rarely need to change it, unless for XML devices.
 
Application developers rarely need to change it, unless for XML devices.
  
== docType ==
+
The encoding charset specified here only affects the output of a ZUML document. For browsers, it is the HTML page which receives. The encoding of the JavaScript files or CSS files that a HTML page might reference are not affected.
 +
 
 +
= docType =
  
 
  [Optional]
 
  [Optional]
 
  [Default: ''depends on the device'']
 
  [Default: ''depends on the device'']
  
It specifies the <tt>DOCTYPE</tt> (the root tag and DTD) that will be generated to the output directly. This directive is mainly used by XML devices. You rarely need to specify the DOCTYPE directive for Ajax or MIL devices. For example,
+
It specifies the <code>DOCTYPE</code> (the root tag and DTD) that will be generated to the output directly. This directive is mainly used by XML devices. You rarely need to specify the DOCTYPE directive for Ajax or MIL devices. For example,
  
  
Line 106: Line 108:
 
</source>
 
</source>
  
Notice that the <tt><!DOCTYPE...></tt> specified in a ZUML page is processed by ZK Loader. It is not part of the output.
+
Notice that the <code><!DOCTYPE...></code> specified in a ZUML page is processed by ZK Loader. It is not part of the output.
  
 
If an empty string is specified, DOCTYPE won't be generated (since 5.0.5):
 
If an empty string is specified, DOCTYPE won't be generated (since 5.0.5):
Line 114: Line 116:
 
</source>
 
</source>
  
== id ==
+
= id =
  
 
  [Optional]
 
  [Optional]
 
  [Default: ''generated automatically''][EL allowed]
 
  [Default: ''generated automatically''][EL allowed]
  
Specifies the identifier of the page, such that we can retrieve it back. If an alphabetical identifier is assigned, it will be available to scripts (aka., <tt>zscript</tt>) and EL expressions embedded in ZUML pages.
+
Specifies the identifier of the page, such that we can retrieve it back. If an alphabetical identifier is assigned, it will be available to scripts (aka., <code>zscript</code>) and EL expressions embedded in ZUML pages.
  
 
<source lang="xml" >
 
<source lang="xml" >
Line 125: Line 127:
 
</source>
 
</source>
  
== language ==
+
= language =
  
 
  [Optional]
 
  [Optional]
  [Default: ''depending on the extension''][Allowed values: <tt>xul/html</tt> | <tt>xhtml</tt>]
+
  [Default: ''depending on the extension''][Allowed values: <code>xul/html</code> | <code>xhtml</code>]
  
Specifies the markup language for this page. The markup language determines the default component set. Currently, it supports <tt>xul/html</tt> and <tt>xhtml</tt>.
+
Specifies the markup language for this page. The markup language determines the default component set. Currently, it supports <code>xul/html</code> and <code>xhtml</code>.
  
'''Note''': You can place the page directive in any location of a XML document, but the <tt>language</tt> attribute is meaningful only if the directive is located at the topmost level.
+
'''Note''': You can place the page directive in any location of a XML document, but the <code>language</code> attribute is meaningful only if the directive is located at the topmost level.
  
== style ==
+
= style =
  
 
  [Optional]
 
  [Optional]
  [Default: <tt>width:100%</tt>]
+
  [Default: <code>width:100%</code>]
 
  [EL allowed]
 
  [EL allowed]
  
Specifies the CSS style used to render the page. If not specified, it depends on the mold. The default mold uses <tt>width:100%</tt> as the default value.
+
Specifies the CSS style used to render the page. If not specified, it depends on the mold. The default mold uses <code>width:100%</code> as the default value.
  
 
<source lang="xml" >
 
<source lang="xml" >
Line 146: Line 148:
 
</source>
 
</source>
  
== title ==
+
= title =
  
 
  [Optional]
 
  [Optional]
Line 153: Line 155:
 
Specifies the page title that will be shown as the title of the browser.
 
Specifies the page title that will be shown as the title of the browser.
  
It can be changed dynamically by calling the <tt>setTitle</tt> method in the <javadoc type="interface">org.zkoss.zk.ui.Page</javadoc> interface.
+
It can be changed dynamically by calling the <code>setTitle</code> method in the <javadoc type="interface">org.zkoss.zk.ui.Page</javadoc> interface.
  
 
<source lang="xml" >
 
<source lang="xml" >
Line 159: Line 161:
 
</source>
 
</source>
  
== widgetClass ==
+
= viewport =
 +
{{versionSince | 6.5.0}}
 +
[Optional]
 +
[Default: ''auto'']
 +
[EL allowed]
 +
 
 +
 
 +
Specifies the page viewport that will define the resolution and scale on browsers. ZK only generates this when it detects a mobile browser.
 +
 
 +
It can be changed dynamically by [https://www.zkoss.org/javadoc/latest/zk/org/zkoss/zk/ui/Page.html#setViewport-java.lang.String-  Page.setViewport()].
 +
 
 +
<source lang="xml" >
 +
<?page viewport="width=device-width,initial-scale=1.0,maximum-scale=5.0"?>
 +
</source>
 +
 
 +
= widgetClass =
  
 
  [Options]
 
  [Options]
Line 172: Line 189:
 
</source>
 
</source>
  
== xml ==
+
= xml =
  
 
  [Optional]
 
  [Optional]
 
  [Default: ''none'']
 
  [Default: ''none'']
  
Specifies the <tt>xml</tt> processing instruction (i.e., <tt><?xml?></tt>) that will be generated to the output. Currently only XML devices support this option.
+
Specifies the <code>xml</code> processing instruction (i.e., <code><?xml?></code>) that will be generated to the output. Currently only XML devices support this option.
  
 
For example,
 
For example,
Line 191: Line 208:
 
</source>
 
</source>
  
== zscriptLanguage ==
+
= zscriptLanguage =
  
 
  [Optional]
 
  [Optional]
  [Default: <tt>Java</tt>][Allowed values: <tt>Java</tt> | <tt>JavaScript</tt> | <tt>Ruby</tt> | <tt>Groovy</tt>]
+
  [Default: <code>Java</code>][Allowed values: <code>Java</code> | <code>JavaScript</code> | <code>Ruby</code> | <code>Groovy</code>]
  
Specifies the default scripting language, which is assumed if an <tt>zscript</tt> element doesn't specify any scripting language explicitly.
+
Specifies the default scripting language, which is assumed if an <code>zscript</code> element doesn't specify any scripting language explicitly.
  
 
<source lang="xml" >
 
<source lang="xml" >
Line 208: Line 225:
 
If this option is omitted, Java is assumed. Currently ZK supports four different languages: Java, JavaScript, Ruby and Groovy. This option is case insensitive.
 
If this option is omitted, Java is assumed. Currently ZK supports four different languages: Java, JavaScript, Ruby and Groovy. This option is case insensitive.
  
'''Note''': Deployers can extend the number of supported scripting languages. Refer to the [http://books.zkoss.org/wiki/Zscript_other_than_java#How_to_Support_More_Scripting_Languages '''How to Support More Scripting Language'''] section in '''the Developer's Guide'''.
+
'''Note''': Deployers can extend the number of supported scripting languages. Please refer to [[ZUML Reference/Extensions/zscript|ZUML Reference]] for more details.
  
==Version History==
+
=Version History=
  
 
{| border='1px' | width="100%"
 
{| border='1px' | width="100%"
Line 222: Line 239:
 
| October, 2010
 
| October, 2010
 
| The widgetClass attribute was introduced.
 
| The widgetClass attribute was introduced.
 +
|-
 +
| 6.5.0
 +
| September, 2012
 +
| The viewport attribute was introduced.
 
|}
 
|}
  
{{ZKZUMLReferencePageFooter}}
+
{{ZUMLReferencePageFooter}}

Latest revision as of 12:11, 17 May 2022

Syntax:

<?page [id="..."] [title="..."] [style="..."] [cacheable="false|true"]
  [language="xul/html"] [zscriptLanguage="Java"]
  [contentType="text/html;charset=UTF-8"]
  [docType="tag PUBLIC "doctype name" "doctype UI""]
  [widgetClass="..."]
  [xml="version="1.0" encoding="UTF-8""]
  [complete="true|false"]
  [automaticTimeout="true|false"]
  [viewport="width=device-width,initial-scale=1.0"]?>

It specifies how a page should be handled. The id and title arguments are the two most important ones.

automaticTimeout

[Optional]
[Since 3.6.3]
[Default: the applicatioin default]

It specifies whether to automatically redirect to the timeout URI. If it is false, a page will be redirected to the timeout URI when the user takes some action after timeout. In other words, nothing would happen if the user does nothing.

If omitted, whether to automatically timeout depends on the application's configuration. Please refer to ZK Configuration Reference: session-config.

A typical use is to turn off the automatic timeout for the timeout page (otherwise, it will be reloaded again after the session is timeout again). For example,

<!-- my timeout page -->
<?page automaticTimeout="false"?>
<zk>
  You didn't access for a while. Please login again.
</zk>

Of course, you don't need to do anything, if the timeout page is not a ZUML page.

cacheable

[Optional]
[Default: false if Ajax devices, true if XML and MIL devices]

It specifies whether the client can cache the output.

Note: Browsers, such as Firefox and IE, don't handle the cache of DHTML correctly, so it is not safe to specify cacheable with true for Ajax devices.

complete

[Optional][Default: false]

It specifies that this page is a complete page. By complete we mean the page has everything that the client expects. For example, if the client is a HTML browser, then a complete page will generate all the necessary HTML tags, such as <html>, <head> and <body>.

By default (false), a ZK page is assumed to be complete if and only if it is not included by other page. In other words, if a ZK page is included by other page, ZK will generate < div> (if the client is a HTML browser) to enclose the output of the (incomplete) ZK page.

If you have a ZK page that contains a complete HTML page and is included by other pages, you have to specify true for this option. For example, the includer is nothing but it includes another page:

//includer.jsp
 <jsp:include page="includee.zhtml"/>


And, the included page contains a complete HTML page:

 <?page complete="true"?>
 <html xmlns="http://www.zkoss.org/2005/zk/native">
     <head>
         <title>My Title</tile>
     </head>
     <body>
         My Content
     </body>
 </html>

contentType

[Optional]
[Default: depends on the device]

It specifies the content type. If not specified, it depends on the device. For Ajax devices, it is text/html;charset=UTF-8. For XML and MIL devices, it is text/xml;charset=UTF-8.

Application developers rarely need to change it, unless for XML devices.

The encoding charset specified here only affects the output of a ZUML document. For browsers, it is the HTML page which receives. The encoding of the JavaScript files or CSS files that a HTML page might reference are not affected.

docType

[Optional]
[Default: depends on the device]

It specifies the DOCTYPE (the root tag and DTD) that will be generated to the output directly. This directive is mainly used by XML devices. You rarely need to specify the DOCTYPE directive for Ajax or MIL devices. For example,


 <?page docType="svg PUBLIC &quot;-//W3C//DTD SVG 1.1//EN&quot; &quot;http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd&quot;"?>

will cause the output to be generated with the following snippet

 <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"">

Notice that the <!DOCTYPE...> specified in a ZUML page is processed by ZK Loader. It is not part of the output.

If an empty string is specified, DOCTYPE won't be generated (since 5.0.5):

<?page docType="" ?>

id

[Optional]
[Default: generated automatically][EL allowed]

Specifies the identifier of the page, such that we can retrieve it back. If an alphabetical identifier is assigned, it will be available to scripts (aka., zscript) and EL expressions embedded in ZUML pages.

 <?page id="${param.id}"?>

language

[Optional]
[Default: depending on the extension][Allowed values: xul/html | xhtml]

Specifies the markup language for this page. The markup language determines the default component set. Currently, it supports xul/html and xhtml.

Note: You can place the page directive in any location of a XML document, but the language attribute is meaningful only if the directive is located at the topmost level.

style

[Optional]
[Default: width:100%]
[EL allowed]

Specifies the CSS style used to render the page. If not specified, it depends on the mold. The default mold uses width:100% as the default value.

 <?page style="width:100%;height:100%"?>

title

[Optional]
[Default: none][EL allowed]

Specifies the page title that will be shown as the title of the browser.

It can be changed dynamically by calling the setTitle method in the Page interface.

 <?page title="${param.title}"?>

viewport

Since 6.5.0

[Optional]
[Default: auto]
[EL allowed]


Specifies the page viewport that will define the resolution and scale on browsers. ZK only generates this when it detects a mobile browser.

It can be changed dynamically by Page.setViewport().

 <?page viewport="width=device-width,initial-scale=1.0,maximum-scale=5.0"?>

widgetClass

[Options]
[Default: depending on the device]
[EL allowed]
[Since 5.0.5]

Specifies the widget class of this page. If not specified, the device's default is assumed. For example, the Ajax device's default is Page.

<?page widgetClass="foo.MyPage"?>

xml

[Optional]
[Default: none]

Specifies the xml processing instruction (i.e., <?xml?>) that will be generated to the output. Currently only XML devices support this option.

For example,

 <?page xml="version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;"?>

will generate the following as the first line of the output

 <?xml version="1.0" encoding="UTF-8"?>

zscriptLanguage

[Optional]
[Default: Java][Allowed values: Java | JavaScript | Ruby | Groovy]

Specifies the default scripting language, which is assumed if an zscript element doesn't specify any scripting language explicitly.

 <?page zscriptLanguage="JavaScript"?>

 <zscript>
     var m = round(box.value); //JavaScript is assumed.
 </zscript>

If this option is omitted, Java is assumed. Currently ZK supports four different languages: Java, JavaScript, Ruby and Groovy. This option is case insensitive.

Note: Deployers can extend the number of supported scripting languages. Please refer to ZUML Reference for more details.

Version History

Version Date Content
5.0.5 October, 2010 If empty, DOCTYPE won't be generated.
5.0.5 October, 2010 The widgetClass attribute was introduced.
6.5.0 September, 2012 The viewport attribute was introduced.



Last Update : 2022/05/17

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