简体   繁体   English

找不到Struts调度程序

[英]Struts dispatcher cannot be found

ERROR comes like : 错误来自:

The Struts dispatcher cannot be found. 找不到Struts调度程序。 This is usually caused by using Struts tags without the associated filter. 这通常是由于使用没有关联过滤器的Struts标记引起的。 Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. Struts标记仅在请求通过其servlet过滤器时可用,该过滤器初始化此标记所需的Struts调度程序。

MY struts.xml 我的struts.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" 

    xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"

xsi:schemaLocation="http://java.sun.com/xml/ns/javaee   http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">

<display-name>Struts2 Login</display-name>

<filter>
    <filter-name>struts2</filter-name>
    <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>

<filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

<welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

my web.xml : 我的web.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.action.excludePattern" value="/ServletToExcludeFromStruts*"    />
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />
<package name="helloworld" extends="struts-default">

    <action name="hello" class="com.struts.action.HelloWorldAction"
        method="execute">
        <result name="success">/HelloWorld.jsp</result>
    </action>
    </package>
 </struts>

and required jar file...[correct me if i am wrong] 和所需的jar文件... [如果我错了,请纠正我]

commons-logging-1.0.4.jar
freemarker-2.3.8.jar
ognl-2.6.11.jar
struts2-core-2.0.11.jar
xwork-2.0.4.jar
commons-collections-3.0.jar
commons-fileupload-1.2.1.jar
commons-lang-2.4.jar
commons-io-1.3.2.jar
javassist-3.0.jar

Your web.xml and struts.xml are fine. 你的web.xml和struts.xml没问题。

The JARs versions are a little different from the required dependencies for Struts 2.0 : JAR版本与Struts 2.0所需的依赖项略有不同:

xwork should be 2.0. xwork应该是2.0。 7 , commons-io should be 1. 0 , and so on. 如图7所示commons-io应为1。0,依此类推。

Btw, since it seems you are starting today with a new Struts2 project, I STRONGLY suggest you to start with the latest Struts2 libraries for at least the following reasons: 顺便说一句,既然你今天开始使用新的Struts2项目,我强烈建议你从最新的Struts2库开始,至少有以下原因:

  1. There is absolutely not a single reason to use a 6 years old library; 使用6年历史的图书馆绝对没有理由; if your company has this rule, then fight with your bosses to change this rule, especially for the following arguments; 如果你的公司有这个规则,那么就和你的老板一起改变这条规则,特别是对于以下论点;
  2. Struts2 versions before 2.3.15.3 are affected by a serious security bug ; 2.3.15.3之前的Struts2版本受到严重安全漏洞的影响 ;
  3. Struts2 has evolved significantly in terms of power, efficiency, speed, bugfixing, and has deprecated several old and buggy libraries, like Struts2-Dojo and the aforementioned FilterDispatcher (since Struts 2.1.3 , you must use the new filter, that is the StrutsPrepareAndExecuteFilter , as written in the FilterDispatcher documentation ) Struts2在功能,效率,速度,错误修正方面已经有了很大的发展,并且已经弃用了几个旧的和错误的库,比如Struts2-Dojo和前面提到的FilterDispatcher(自Struts 2.1.3 ,你必须使用新的过滤器,即StrutsPrepareAndExecuteFilter) ,如FilterDispatcher文档中所写)
  4. With new Struts2 versions, you can use the new plugins out there, that will add real values to your webapp, especially: 使用新的Struts2版本,您可以使用新的插件,这将为您的webapp添加真正的值,尤其是:

Then start a new project with the latest libraries (currently 2.3.16.1 ), preferibly with Maven, or either by hand paying attention to the required dependencies and their versions . 然后使用最新的库(目前为2.3.16.1 )开始一个新项目,最好是使用Maven,或者手工注意所需的依赖项及其版本

Download a Release of Apache Struts 下载Apache Struts的一个版本

我想你已经交换了两个文件(struts.xml和web.xml)的内容,这就是你收到这个错误的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 找不到Struts调度程序 - The Struts dispatcher cannot be found Struts错误:无法找到Struts调度程序 - Struts Error: The Struts dispatcher cannot be found Struts-异常-找不到Struts调度程序 - Struts - Exception - The Struts dispatcher cannot be found 在struts2中找不到Struts调度程序 - The Struts dispatcher cannot be found in struts2 部署时找不到Struts调度程序 - The Struts dispatcher cannot be found while deploy 异常处理ErrorPage。找不到Struts调度程序.org.apache.jasper.JasperException:找不到Struts调度程序 - Exception Processing ErrorPage .The Struts dispatcher cannot be found.org.apache.jasper.JasperException: The Struts dispatcher cannot be found 在 WebLogic 12.1.3 上部署应用程序时出现“找不到 Struts 调度程序”错误 - "The Struts dispatcher cannot be found" error while deploying application on WebLogic 12.1.3 struts 2调度程序和tomcat 6安全性 - struts 2 dispatcher and tomcat 6 security org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter 无法使用嵌入式 Tomcat 转换为 Struts 2 中的 javax.servlet.Filter - org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter cannot be cast to javax.servlet.Filter in Struts 2 using embedded Tomcat 分派器初始化因Struts2而失败 - Dispatcher initialization failed with Struts2
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM