JSP

From Documentation

Employment/Purpose

Here describes how to use ZK with a JSP page. Basically there are two approaches.

  1. Use <jsp:include> to include a ZUL page.
  2. Use ZK JSP Tags in a JSP page directly.

Prerequisite

DOCTYPE

To use ZK components correctly, the JSP page must specify DOCTYPE as follows.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
...

Browser Cache

Though optional, it is suggested to disable the browser to cache the result page. It can be done as follows.

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="-1" />

HTML form

ZK input components (datebox, slider, listbox and so on) work seamlessly with HTML form. In additions to Ajax, you could process input in batch with legacy Servlets.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ taglib uri="http://www.zkoss.org/jsp/zul" prefix="z" %>

<html>
  <body>
    <z:page>
    <form action="/foo/legacy">
      <table>
        <tr>
          <td>When</td><td><z:datebox name="when"/></td>
        </tr>
        <tr>
          <td>Which></td>
          <td>
            <listbox name="which">
                <listitem/>
                <listitem/>
            </listbox>
          </td>
        </tr>
        <tr>
          <td><z:button type="submit" label="Submit"/></td>
          <td><z:button type="reset" label="Reset"/></td>
        </tr>
    </form>
    </z:page>
  </body>
</html>

Version History

Version Date Content
     



Last Update : 2010/10/15

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