Non-XUL extension.
If this component is the only child of its parent, the default width and height will become 100%.
Since 3.6.2, there are three modes: auto (default), instant and defer. The behavior prior to 3.6.2 is the same as the defer mode. The default mode is auto
since 5.0. However, you can change it to defer
by specifying a library property named org.zkoss.zul.include.mode
(for fully backward compatibility).
In the instant mode, the page to be included are loaded 'instantly' with {@link Execution#createComponents} when {@link #afterCompose}is called. Furthermore, the components are created as the child components of this include component (like a macro component).
Notices:
In the defer mode (the only mode supported by ZK prior to 3.6.2), the page is included by servlet container (the include
method of javax.servlet.RequestDispatcher
) in the render phase (i.e., after all components are created). The page can be any servlet; not limited to a ZUML page.
If it is eventually another ZUML page, a ZK page ( {@link org.zkoss.zk.ui.Page}) is created and added to the current desktop. You can access them only via inter-page API (see {@link org.zkoss.zk.ui.Path}).
In the auto mode, the include component decides the mode based on the name specified in the src property ( {@link #setSrc}). If src
is ended with the extension named .zul
or .zhtml
, the instant
mode is assumed. Otherwise, the defer
mode is assumed. Notice that if a query string is specified, the defer
mode is assumed, too.
Notice that invoking {@link #setProgressing} or {@link #setLocalized}with true will imply the defer
mode (if the mode is auto
).
There are two ways to pass parameters to the included page:
First, since ZK 3.0.4, you can use {@link #setDynamicProperty}, or, in ZUL,
<include src="/WEB-INF/mypage" arg="something"/>
Second, you can use the query string:
<include src="/WEB-INF/mypage?arg=something"/>
With the query string, you can pass only the String values. and the parameter can be accessed by {@link Execution#getParameter}or javax.servlet.ServletRequest's getParameter. Or, you can access it with the param variable in EL expressions.
On the other hand, the dynamic properties ( {@link #setDynamicProperty}) are passed to the included page thru the request's attributes You can pass any type of objects you want. In the included page, you can access them by use of {@link Execution#getAttribute} or javax.servlet.ServletRequest'sgetAttribute. Or, you can access with the requestScope variable in EL expressions.
In additions to macro and {@link Include}, you can use the fulfill attribute as follows: <div fulfill="=/my/foo.zul">...</div>
@author tomyeh
@see Iframe
|
|