0

ZK5 Include

asked 2010-03-05 06:11:40 +0800

romen gravatar image romen
33 1 3

updated 2010-03-05 06:12:50 +0800

I encountered this problem when migrating from 3.6.3 to 5. I am having problems wiht the Include api:

Include inc=new Include("romen.html"); // this works

Include inc=new Include("romen.zul"); // this does not work, included area shows blank
// I can get it to work by adding the following
inc.setMode("defer"); // this should be wrong according to javadoc since auto will treat .zul as 'instant'

BTW, the <include> tag works fine. Is this a bug?

cheers
romen

delete flag offensive retag edit

16 Replies

Sort by » oldest newest

answered 2010-03-09 04:51:07 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

Hi, romen
yes, it is a bug
we post it here
we will track it

link publish delete flag offensive edit

answered 2010-03-20 22:22:48 +0800

aktejo gravatar image aktejo
155 3

hi as 1225, i have another problem with version 5.0 include. its when i set SRC of the include with http request parameter with it

like inc.setSrc("zuls/aktejo.zul?id=1");

the page doesn't load and server output this message:
WARNING: Removing non-exist page: [Page z_jp_ih]
Current pages: [[Page mainPage]]

everything works fine if I omit the request parameter, like this:
inc.setSrc("zuls/aktejo.zul");

or are there any other way to pass information to newly loaded page ?
tq

link publish delete flag offensive edit

answered 2010-03-20 23:29:53 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

I write a test
It works well on ZK 5.0.1

index.zul

<zk>	
	<include id="inc"/>
	<zscript><![CDATA[
		inc.setSrc("page1.zul?id=1");               
	]]></zscript>
</zk>


page1.zul
<zk>	
	<label value="value = ${param.id}"/>
</zk>

link publish delete flag offensive edit

answered 2010-03-22 04:46:49 +0800

aktejo gravatar image aktejo
155 3

Hi as1225
I changed the library into latest 5.0.1
warning still show up on server output,

WARNING: Removing non-exist page: [Page z_jp_ih]

this is the code triggering inclusion of the page:


Include subInclude;
South subPanel;


public void onClick$miLogin(Event evt) throws Exception {
String uri = "zuls/tesincludezul.zul?id=tejo&uid="+UUID.randomUUID().toString();
System.out.println("uri included:"+uri);
subInclude.setSrc(uri);
subPanel.setOpen(true);
}

the include reside inside south panel


the UUID generate random uniq id on every click execution,.
on the second click, the warning start to show up.

if the included page is quite complex, then the page can't render well

link publish delete flag offensive edit

answered 2010-03-22 23:39:29 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

Hi, aktejo
Could post your sample code for reproduce this problem?

link publish delete flag offensive edit

answered 2010-03-23 03:37:22 +0800

aktejo gravatar image aktejo
155 3

updated 2010-03-23 03:47:07 +0800

Hi again jimmy, hmm, i will try to isolate the problem and create small web project to reproduce it, since my current project involving some hibernate connection
(btw don't know how to upload the code ?).

but, i have annother question, i sout (System.out. println) some text inside a doAfterCompse of an included page,.. form the server out put then i know that doAfterCompose is executed twice even if i invoked include.setSrc once.
code which invoke setSrc

 public void onClick$miLogin(Event evt) throws Exception {
        String uri = "zuls/tesincludezul.zul";
        Map p = MapUtil.newMap().store("id", "tejo").store("uid", UUID.randomUUID().toString());
        subInclude.setSrc(uri); // subInclude is an include inside subPanel
        subPanel.setOpen(true);//subPanel is a shout
    }

controller of included page: extension of GenericForwardComposer

 @Override
    public void doAfterCompose(Component comp) throws Exception {
        super.doAfterCompose(comp);
        System.out.println("executing do AfterCompose"); //this line executed twice

        //Sdi.addPageLoadListener(self, new onPageLoad());
    }

link publish delete flag offensive edit

answered 2010-03-29 21:02:21 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

OK, maybe it is a bug,
you can use Executions.createComponents(uri, panelchildren, null); to instead it

link publish delete flag offensive edit

answered 2010-07-28 04:53:53 +0800

dongpeng gravatar image dongpeng
84 1

hi , aktejo
I got the same issue as you,

and I try to remove the Include component and create new one, the Warning msg disappeared,

my code looks likes this:


public void onClick$xxx(Event event)
{
mybox.removeChild( mybox.getFistChild()  );//mybox containts the Include comp
Include inc = new Include( url );
mybox.appendChild( inc );
}

link publish delete flag offensive edit

answered 2010-08-03 22:19:07 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

updated 2010-08-03 22:19:31 +0800

Hi dongpeng
I tested my sample with ZK 5.0.3
it worked well

<zk>
	<box id="mybox">
		<include src="page1.zul"></include>
	</box>
	<button label="update model">
		<attribute name="onClick"><![CDATA[
			mybox.removeChild(mybox.getFirstChild());//mybox containts the Include comp
			Include inc = new Include("page2.zul");
			mybox.appendChild(inc);
		]]></attribute>
	</button>
</zk>

link publish delete flag offensive edit

answered 2010-08-13 07:03:35 +0800

xiaohongboabcd gravatar image xiaohongboabcd
78 1

I have a question with the 5.0.3 ,give the some of the code
this is index.zul

<borderlayout height="700px" width="100%" apply="com.gianstone.zk.demo.login.Index">
......
......
<vbox spacing="5" id="centerbox" width="100%" style="border: px solid grey;margin-top:3%" height="370px">
	<include  id="include" src="content.zul" />
</vbox>

this is content.zul
	<box width="100%">
		<hbox width="100%">
			<combobox readonly="true">
				<comboitem label="待处理安排事项" id="label1"/>
				<comboitem label="任务"/>
				<comboitem label="项目"/>
			</combobox>
		</hbox>
		<hbox width="100%">
			<textbox id="text"  width="100%" rows="20"/>
		</hbox>
	</box>

I use include$text in the Index.java show the include$text is null
this is some of the index.java

public class Index extends GenericForwardComposer {
	private Calendar cal;
//	private Include include;
	private Textbox include$text;
	public void doAfterCompose(Component comp){
		try {
			super.doAfterCompose(comp);
			include$text.setValue("12345");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

link publish delete flag offensive edit
Your reply
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

Follow

RSS

Stats

Asked: 2010-03-05 06:11:40 +0800

Seen: 2,085 times

Last updated: Jun 05 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More