Foreign Templating Framework"
(Created page with '{{ZKDevelopersReferencePageHeader}} =Employment/Purpose= Here describes how to make a ZUL page to be assembled in a foriegn templating framework, such as [http://tiles.apache.or…') |
|||
Line 2: | Line 2: | ||
=Employment/Purpose= | =Employment/Purpose= | ||
− | Here describes how to make a ZUL page to be assembled in a | + | Here describes how to make a ZUL page to be assembled with Ajax in a foreign templating framework, |
such as [http://tiles.apache.org/ Apache Tiles]. | such as [http://tiles.apache.org/ Apache Tiles]. | ||
− | + | ZK supports many powerful layout components, such as portallayout, borderlayout, tablelayout, columnlayout and so on<ref>For more information, please refer to [[ZK Component Reference]].</ref>. It is recommended to use them. Of course, read this chapter only if you prefer to use other templating framework. | |
+ | |||
+ | <blockquote> | ||
+ | ---- | ||
+ | <references/> | ||
+ | </blockquote> | ||
+ | |||
+ | =DOCTYPE= | ||
To use ZK components correctly, the templating page must specify DOCTYPE as follows. | To use ZK components correctly, the templating page must specify DOCTYPE as follows. | ||
Line 16: | Line 23: | ||
... | ... | ||
</source> | </source> | ||
+ | |||
+ | =Make a ZUL page as a fragment= | ||
+ | |||
+ | By default, if a ZUL page is requested by the browser directly, it will generate a complete HTML structure, including HTML, HEAD and BODY tags. On the other hand, if the assembling is done by inclusion (javax.servlet.RequestDispatcher's include), a ZUL page will be generated as a HTML fragment without HTML, HEAD, and BODY. For example, if a ZUL page is included by <code>jsp:include</code>, then it won't generate HTML/HEAD/BODY, such that the following JSP page will be rendered correctly. | ||
+ | |||
+ | <source lang="xml"> | ||
+ | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | ||
+ | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
+ | <%-- a JSP page --%> | ||
+ | <html> | ||
+ | <body> | ||
+ | <jsp:include page="frag.zul"/> | ||
+ | ... | ||
+ | </source> | ||
+ | |||
+ | In other words, if the result page is assembled when the request is received, you don't need to do anything specially<ref>You might take a look at [[ZK_Developer's_Reference/Integration/Use_ZK_in_JSP|Use ZK in JSP]] for more information.</ref>. However, if the assembling is done at the client side by using Ajax to request fragments after loaded, you have to read the following section. | ||
+ | |||
+ | ==Request a ZUL page with Ajax== | ||
=Version History= | =Version History= |
Revision as of 06:17, 15 October 2010
Employment/Purpose
Here describes how to make a ZUL page to be assembled with Ajax in a foreign templating framework, such as Apache Tiles.
ZK supports many powerful layout components, such as portallayout, borderlayout, tablelayout, columnlayout and so on[1]. It is recommended to use them. Of course, read this chapter only if you prefer to use other templating framework.
- ↑ For more information, please refer to ZK Component Reference.
DOCTYPE
To use ZK components correctly, the templating 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>
...
Make a ZUL page as a fragment
By default, if a ZUL page is requested by the browser directly, it will generate a complete HTML structure, including HTML, HEAD and BODY tags. On the other hand, if the assembling is done by inclusion (javax.servlet.RequestDispatcher's include), a ZUL page will be generated as a HTML fragment without HTML, HEAD, and BODY. For example, if a ZUL page is included by jsp:include
, then it won't generate HTML/HEAD/BODY, such that the following JSP page will be rendered correctly.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%-- a JSP page --%>
<html>
<body>
<jsp:include page="frag.zul"/>
...
In other words, if the result page is assembled when the request is received, you don't need to do anything specially[1]. However, if the assembling is done at the client side by using Ajax to request fragments after loaded, you have to read the following section.
Request a ZUL page with Ajax
Version History
Version | Date | Content |
---|---|---|
5.0.5 | October, 2010 | ZUL page is able to be generated as a HTML fragment. |
- ↑ You might take a look at Use ZK in JSP for more information.