首先,为了避免重复问题标签,我的问题是我有4个不同的struts2动作调用。其中3个工作完美但第四个却无法找到调度员。现在原来的问题是:
我有一个运行struts2作为后端的dinamic web项目。我还使用瓷砖作为标题和导航栏。地图中有4个按钮,其中3个按钮完美运行。但是当涉及到第四个时,调度程序失败,甚至自定义404页面也不会出现。
我的struts.xml看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="false" />
<constant name="struts.custom.i18n.resources" value="ApplicationResources" />
<package name="default" extends="struts-default" namespace="/">
<result-types>
<result-type name="tiles"
class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
<action name="main" method="gotoMain" class="controller.NavActions">
<result name="main" type="tiles">/tiles.main</result>
<result name="error">/utils/error.jsp</result>
</action>
<action name="arrive" method="gotoArrive" class="controller.NavActions">
<result name="arrive" type="tiles">/tiles.arrive</result>
<result name="error">/utils/error.jsp</result>
</action>
<action name="depart" method="gotoDepart" class="controller.NavActions">
<result name="depart" type="tiles">/tiles.depart</result>
<result name="error">/utils/error.jsp</result>
</action>
<action name="finder" method="gotoFinder" class="controller.NavActions">
<result name="finder" type="tiles">/tiles.finder</result>
<result name="error">/utils/error.jsp</result>
</action>
<action name="find_flight" method="findFlight" class="controller.NavActions">
<result name="find" type="tiles">/tiles.find.flight</result>
<result name="error">/utils/error.jsp</result>
</action>
</package>
</struts>
导航器html是下一个,struts前缀为's':
<ul class="nav nav-pills nav-stacked custom-nav">
<li id="main" class="nav-item"><s:a action="main">
<i class="fa fa-play"></i>
<span>Dashboard</span>
</s:a></li>
<li id="depart" class="nav-item"><s:a action="depart">
<i class="fa fa-plane" aria-hidden="true"></i>
<span>Departures</span>
</s:a></li>
<li id="arrive" class="nav-item"><s:a action="arrive">
<i class="fa fa-plane fa-rotate-90" aria-hidden="true"></i>
<span>Arrivals</span>
</s:a></li>
<li id="finder" class="nav-item"><s:a action="finder">
<i class="lnr lnr-magnifier"></i>
<span>Finder</span>
</s:a></li>
</ul>
调度程序在这里失败,没有达到Java方法。我不发布Java代码,因为它只返回所需的字符串并更改字段。 tomcat控制台错误是下一个错误:
GRAVE: El Servlet.service() para servlet jsp lanzó una excepción
The Struts dispatcher cannot be found. This is usually caused by using
Struts tags without the associated filter. Struts tags are only usable
when the request has passed through its servlet filter, which
initializes the Struts dispatcher needed for this tag. - [unknown
location]
at org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:58)
at org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:44)
at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:48)
at org.apache.jsp.utils.error_jsp._jspx_meth_s_005fproperty_005f0(error_jsp.java:193)
at org.apache.jsp.utils.error_jsp._jspService(error_jsp.java:153)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:720)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:468)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318)
at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:442)
at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:301)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:178)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1100)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:687)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
ene 15, 2017 12:12:41 PM org.apache.catalina.core.StandardHostValve custom
GRAVE: Exception Processing ErrorPage[errorCode=404, location=/utils/error.jsp]
org.apache.jasper.JasperException: The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]
at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:560)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:476)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:720)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:468)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:391)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:318)
at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:442)
at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:301)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:178)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1100)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:687)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]
at org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:58)
at org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:44)
at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:48)
at org.apache.jsp.utils.error_jsp._jspx_meth_s_005fproperty_005f0(error_jsp.java:193)
at org.apache.jsp.utils.error_jsp._jspService(error_jsp.java:153)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:438)
... 24 more
一组行动很好,但是当涉及到发现者时,调度员会崩溃。如果我再次在URL中引入操作,它将起作用,但是当我再次尝试时,再次弹出错误。