Use of ZK JSP Tags

From Documentation

Stop.png This documentation is for an older version of ZK. For the latest one, please click here.


ZK provides an equivalent JSP tags for each ZUL component. If you'd like to use them in your JSP pages, simply following the following steps.

  1. Specify http://www.zkoss.org/jsp/zul as the URI of the TLD file in the JSP pages with the taglib directive.
  2. Though optional, it is better to specify DOCTYPE as XHTML 1.0 Transitional, since ZK Client Engine assumes it.
  3. The top of ZK JSP tags must be the page tag (ZK's org.zkoss.zul.jsp.PageTag), which represents a ZK page.

The following is a simple example.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "[http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd]">
<%@ taglib uri="http://www.zkoss.org/jsp/zul" prefix="z" %>
<html>
	<head>
		<title>Test of ZUL on JSP</title>
	</head>
	<body>
		<h1>1. Header outside z:page</h1>
		<z:page>
			<h2>2. Header in z:page</h2>
			<z:window id="win" title="Test" border="normal">
				<p>3. Content in z:window</p>
				<z:button label="Overlap" onClick="win.doOverlapped()" />
			</z:window>
			<p>
				4. Content in z:page after z:window
			</h2>
		</z:page>
		<p>5. Content after z:page</p>
	</body>
</html>

Each ZUL component is wrapped with a JSP tag and each property is wrapped with an attribute the JSP tag. Furthermore, you are free to mix ZK JSP tags with other tags. Thus, the use of ZK JSP tags is straightforward.



Last Update : 2022/01/19

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