Structuring zul-code without includes?

asked 2015-03-23 09:11:18 +0800

cka gravatar image cka
3 1

updated 2015-03-23 12:58:10 +0800

In my situation I have a list of objects in my first browser "page" and with a click on one row I get the details of one object.

I structured the detail 'page' in a 'main-zul' and several "sub-zul"s, which each contain one tab on this page. These sub-zuls are included by the zkoss-include-mechanism.

For structuring and reusing the zul-code this is a good mechanism, but I see several disadvantages:

  • I cannot pass parameters from the list-page to the sub-zuls. (I use Executions.createComponent() and the map is only transported to main-zul, because the include-Component is creating a new component with an own parameter-stack.)

  • The sub-zuls and the main-zul are not on the same zkoss-page, but on the same desktop. For eventing I see several advantages to use the page-level eventing. (No old listener to unsubscribe after a reload.)

Is there a possibilty to "include" zuls without having a new page, only to structure the zul-code?

Are there other mechanisms to structure zul-code?



delete flag offensive retag edit

1 Answer

Sort by » oldest newest most voted

answered 2015-03-27 04:48:44 +0800

echarish gravatar image echarish flag of Japan
1809 7

you can create your custom div

IncludeDiv extends Div implements AfterCompose

and than in this div inside the method

public void afterCompose()

you can use

Executions.createComponentsDirectly(contentString, "zul", this, args);

where args is the map of parameter you can pass to your div when you create it in your master zul where you use your include.

<includediv args="${arg}" componentName="file:metainfo/web/someTab.zul"/>
link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools




Asked: 2015-03-23 09:11:18 +0800

Seen: 19 times

Last updated: Mar 27 '15