我正在尝试创建我的第一个Tiles网页。 我使用this tutorial并完成所有配置后,我得到了这样的例外:
java.lang.NullPointerException
at org.apache.tiles.access.TilesAccess.getContainer(TilesAccess.java:124)
at org.apache.tiles.access.TilesAccess.getContainer(TilesAccess.java:107)
at org.apache.tiles.access.TilesAccess.getCurrentContainer(TilesAccess.java:174)
at org.apache.tiles.template.InsertDefinitionModel.execute(InsertDefinitionModel.java:95)
at org.apache.tiles.jsp.taglib.InsertDefinitionTag.doTag(InsertDefinitionTag.java:254)
at org.apache.jsp.menu.menu_jsp._jspx_meth_tiles_005finsertDefinition_005f0(menu_jsp.java:92)
at org.apache.jsp.menu.menu_jsp._jspService(menu_jsp.java:65)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
我创建了tiles-defs.xml并将所有配置添加到我的web.xml。
答案 0 :(得分:0)
我走同一个教程,发现缺少配置。将其添加到web.xml
:
<listener>
<listener-class>org.apache.tiles.web.startup.simple.SimpleTilesListener</listener-class>
</listener>
此侦听器将跟踪应用程序启动并将以默认方式配置切片(主切片配置应仅在此处:/WEB-INF/tiles.xml
),只要在默认配置中进行硬编码。