From Documentation

Jump to: navigation, search



Location: WEB-INF/web.xml

[Required] Class: DHtmlLayoutServlet

ZK Loader is a servlet used to load ZUML pages when the Web server receives URL requests sent by the users.

Notice that you must specify load-on-startup since many other servlets depend on the ZK loader.


Here is a complete sample.

The Initial Parameters

update-uri [Required]

It specifies the URI which the ZK AU engine is mapped to.

For example, if the ZK AU engine is mapped to /zkau/*, by the use of servlet-mapping, then specify /zkau for this parameter.

Note: if the servlet container is used with other Web server, like Apache, you have to map this update URI to the servlet container (in additions to zul and zhtml files).

compress [Optional][Default:true]

It specifies whether to compress the output if the browser supports the compression (Accept-Encoding) and this Servlet is not included by other Servlets.

log-level [Optional]

It specifies the default log level for org.zkoss. If not specified, the system default (usually INFO) is used.

Possible values: OFF, ERROR, WARNING, INFO, DEBUG and FINER. Please refer to ZK Developer's Reference for details.

Map URL to ZUML pages

It is suggested to map this servlet to the zul and zhtml extensions as shown below to process ZUML pages. It is OK if you want to prefer to use xul and html as the extension; just map them to ZK Loader too.

		<description>ZK loader for evaluating ZUML pages</description>
		<load-on-startup>1</load-on-startup><!-- MUST -->

Here is a complete sample.

Map URL to Richlets

Assume you have a richlet named foo.FooRichlet. Then, you could configure it as follows.

First, declare the richlet:


Second, map the richlet to any number of URL you want:


Notice that, by default, richlets are disabled. To enable them, add the following declaration to web.xml. Once enabled, you can add as many as richlets as you want without modifying web.xml any more. Of course, url-pattern could be any pattern you prefer.

    <url-pattern>/zk/*</url-pattern><!-- any pattern you prefer -->

Then, you can visit http://localhost:8080/PROJECT_NAME/zk/foo to request the richlet.

The URL specified in the url-pattern element must start with /. If the URI ends with /*, then it is matched to all request with the same prefix. To retrieve the request's actual URL, you can check the value returned by the Page.getRequestPath.

Version History

Version Date Content

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

You got stuck here?
Let us know how we can improve this page
For specific questions please use the forum