Reputation: 37034
I try to pass parameter to zul when I create it:
.zul file:
<window xmlns="http://www.zkoss.org/2005/zul"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:h="http://www.w3.org/1999/xhtml"
xmlns:zk="http://www.zkoss.org/2005/zk"
xmlns:ca="http://www.zkoss.org/2005/zk/client"
xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd "
border="normal"
closable="false"
position="center,center"
width="383px"
height="270px"
onCancel="self.detach();"
id="decisionCommentWindow"
title="${c:l('approvalTaskWindow.title')}"
use="handlers.ZulHandler">
<zk if="${isManufacturingKey}">
<checkbox id="checkbox_id" label="check" />
</zk>
</window>
java code, that create zul:
...
Map args = new HashMap<String, Boolean>();
Boolean isManufacturing = true;
args.put("isManufacturingKey", isManufacturing);
ZulHandler window = Preconditions
.checkNotNull((ZulHandler) Executions.createComponents(
"/decision_comment_window.zul", null, args));
window.setTitle(decisionModel.getName() + " decision");
if (isManufacturing) {
Checkbox checkbox = (Checkbox) Path
.getComponent("/decisionCommentWindow/emergency_change_checkbox_id");
checkbox.setChecked(workflow.getEmergencyChange());//I have Null pointer here because checkbox is null
}
...
I have null pointer here.
Can you help me?
Upvotes: 0
Views: 1350
Reputation: 37034
feel the differences:
wrong variant:
<zk if="${isManufacturingKey}">
right variant:
<zk if="${arg.isManufacturingKey}">
maybe cause of this problem is the old version of using zk framework - I don't know.
Upvotes: 1