我创建了一个Richlet Java类,并链接到zk.xml中,它工作正常。
现在,我试图在一个简单的zul页面中包含此richlet,但出现错误。
<zk xmlns:w="client" xmlns:n="native">
<window>
<include src="/zk/testdebug" mode="instant"/> <!-- creates another page -->
</window>
</zk>
这是我的日志错误
SEVERE: Failed to assign [src=/zk/testdebug] to <Include uP9Q1>
Unknown exception: java.lang.reflect.InvocationTargetException.
2015-11-05 17:48:37.542:WARN:oejs.ServletHandler:/demoZK/test.zul
java.lang.NullPointerException
at org.zkoss.zul.Include.fixModeOnly(Include.java:356)
at org.zkoss.zul.Include.fixMode(Include.java:347)
at org.zkoss.zul.Include.setSrc(Include.java:283)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.zkoss.zk.ui.metainfo.Property.assign0(Property.java:299)
at org.zkoss.zk.ui.metainfo.Property.assign(Property.java:171)
at org.zkoss.zk.ui.metainfo.ComponentInfo.applyProperties(ComponentInfo.java:732)
at org.zkoss.zk.ui.impl.AbstractUiFactory.newComponent(AbstractUiFactory.java:136)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:908)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:877)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:748)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:709)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:923)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:877)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:748)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:822)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:771)
at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:709)
at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:452)
at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:358)
at org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:217)
at org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:136)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:734)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:594)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:486)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
at
最佳答案
这就是我在web.xml中映射zkLoader的方式
<servlet-mapping>
<servlet-name>zkLoader</servlet-name>
<url-pattern>/zk/*</url-pattern>
</servlet-mapping>
所以我试图删除主路径“ / zk”,现在我可以像这样包含我的richlet
<zk xmlns:w="client" xmlns:n="native">
<window>
<include src="/testdebug" mode="instant"/> <!-- creates another page -->
</window>
</zk>
它工作正常。