Include fellow problem

asked 2016-11-28 13:17:46 +0800

sandalo gravatar image sandalo
25 3

updated 2016-11-28 13:38:41 +0800

Hi everyone, I need to split my screen into several .zul. I'm using includes to achieve this. However when I try to retrieve the elements inside the includes, through getFellow they are null. All help is good.

Sândalo Bessa

Look at the code:

Window main--------------------------------

<window title="Test" apply="test.Controller">
    <include src="testinclude.zul" mode="instant"></include>
    <button label="Test" onclick="$Controller.test()"></button>

Window included--------------------------------
<window title="Teste Include"> <textbox id="teste"></textbox> </window> Controller-------------------------------------
package teste; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.util.GenericForwardComposer; import org.zkoss.zul.Window; @SuppressWarnings("rawtypes") public class Controller extends GenericForwardComposer { /** * */ Window window; private static final long serialVersionUID = 1706388158004585874L; @SuppressWarnings("unchecked") @Override public void doAfterCompose(Component comp) throws Exception { super.doAfterCompose(comp); window = (Window) comp; System.out.println(); } public void test(){ window.getFellowIfAny("test",true);//return null, here } }
delete flag offensive retag edit

1 Answer

Sort by » oldest newest most voted

answered 2016-11-28 13:50:23 +0800

chillworld gravatar image chillworld flag of Belgium
5322 4 9

Pretty normal you have null there.

Include implements the IDSpace interface, what means that you can have the same id's under the include as under you window.

If you need first fetch your include and then query further.

Or use :


As explained here : https://www.zkoss.org/wiki/ZKDeveloper'sReference/UIComposing/IDSpace

link publish delete flag offensive edit


Thanks Chillworld, I think that use "templateURI" with the tag <apply> is the better option.

sandalo ( 2016-11-28 17:08:20 +0800 )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

1 follower



Asked: 2016-11-28 13:17:46 +0800

Seen: 29 times

Last updated: Nov 28 '16

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