Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/348.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 我可以在zk中的hbox中使用include吗?_Java_Zk - Fatal编程技术网

Java 我可以在zk中的hbox中使用include吗?

Java 我可以在zk中的hbox中使用include吗?,java,zk,Java,Zk,我的zul中有以下代码: <hbox> <include src="firstInclude.zul" /> <include src="secondInclude.zul" /> </hbox> 我一直收到firstInclude.zul的页面未找到错误。firstInclude.zul文件与包含上述代码的文件位于同一目录中。另一方面,包含上述代码的zul文件动态地包含在模式窗口中。窗口的viewmodel正在执行此任务。我做错

我的zul中有以下代码:

<hbox>
   <include src="firstInclude.zul" />
   <include src="secondInclude.zul" />
</hbox>


我一直收到firstInclude.zul的页面未找到错误。firstInclude.zul文件与包含上述代码的文件位于同一目录中。另一方面,包含上述代码的zul文件动态地包含在模式窗口中。窗口的viewmodel正在执行此任务。我做错了什么

相对包含路径根据当前桌面的路径(当前显示的
main.zul
的位置)进行解析

如果要在代码中检查此项,请在中放置一个断点,并观察传入了哪个
uri
,哪个
currentDirectory

(此过程独立于任何组件,因此
与此无关。此外,此过程独立于动态使用。)

假设此静态结构:

/pages/main.zul
/pages/sub/sub.zul
/pages/sub/sub-include.zul
main.zul

<div>
    <include src="sub/sub.zul"/>
</div>
更改包含的src url(如下所示)将解决此问题

<include src="sub/sub-include.zul"/>

谢谢。解决了我的问题!我永远也猜不到。。。。
org.zkoss.zk.ui.UiException: Page not found: /pages/sub-include.zul
    at org.zkoss.zk.ui.http.ExecutionImpl.getPageDefinition(ExecutionImpl.java:385)
    at org.zkoss.zul.Include.afterCompose(Include.java:509)
    ...
<include src="sub/sub-include.zul"/>
<include src="/pages/sub/sub-include.zul"/>