The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter.

异常信息: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.

环境:tomcat5.5.0

struts.xml信息

<?xml version="1.0" encoding="UTF-8"?> 
<web-app version="2.4"  
    xmlns="http://java.sun.com/xml/ns/j2ee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
  <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>*.action</url-pattern> 
  </filter-mapping> 
  <welcome-file-list> 
    <welcome-file>index.jsp</welcome-file> 
  </welcome-file-list> 
</web-app> 
         struts.xml 信息:

<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "http://struts.apache.org/dtds/struts-2.0.dtd"
<struts> 
  <include file="struts-default.xml"/> 
  <package name="ygn.action" extends="struts-default"> 
    <action name="HelloWorld" class="ygn.action.HelloWorld"> 
      <result>HelloWorld.jsp</result> 
    </action> 
  </package> 
</struts> 
       SayHello.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%> 
<%@ taglib prefix="s" uri="/struts-tags" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"
<html> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
<title>Say Hello</title> 
</head> 
<body> 
  <h3>Say "Hello" to :</h3> 
  <s:form action="HelloWorld"> 
    Name:<s:textfield name="name"/> 
    <s:submit/> 
  </s:form> 
</body> 
</html>

异常分析:以上的配置及文件中,如果采用 http://ip:port/SayHello.jsp,那么会出现前面所提到的异常。如果采用http://ip:port/SayHello.action 进行访问,那么正常。

原因:如果想要在jsp文件中,采用 struts的tag,那么必须通过web.xml所配置的过滤器访问文件,否则会有异常,即 之前所出现的异常。

解决方案:

方案一:

采用 http://ip:port/SayHello.action 访问

方案二:

将web.xml 的过滤器,从 *.action 修改为: /*

方案三:

修改SayHello.jsp 文件,不使用 struts 的标签。

The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter.的更多相关文章

  1. The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. 异常

    异常信息如下: The Struts dispatcher cannot be found. This is usually caused by using Struts tags without t ...

  2. The Struts dispatcher cannot be found. This is usually caused by using Struts

    对于struts2中的问题: org.apache.jasper.JasperException: The Struts dispatcher cannot be found. This is usu ...

  3. The Struts dispatcher cannot be found. This is usually caused by using Struts ta

    HTTP Status 500 - type Exception report message description The server encountered an internal error ...

  4. The Struts dispatcher cannot be found. This is usually caused by using Strut

    The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the assoc ...

  5. struts2错误:The Struts dispatcher cannot be found.

    struts2错误:The Struts dispatcher cannot be found. The Struts dispatcher cannot be found. This is usua ...

  6. 解决struts2中UI标签出现的问题: The Struts dispatcher cannot be found

    解决struts2中UI标签出现的问题: The Struts dispatcher cannot be found 异常信息: The Struts dispatcher cannot be fou ...

  7. The Struts dispatcher cannot be found异常的解决方法

    系统错误:HTTP Status 500 异常信息:The Struts dispatcher cannot be found.  This is usually caused by using St ...

  8. 用Struts2框架报错:The Struts dispatcher cannot be found

    报错信息 The Struts dispatcher cannot be found.  This is usually caused by using Struts tags without the ...

  9. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has p

    2014-09-16 15:47:51.590:WARN:oejs.ErrorPageErrorHandler:EXCEPTION org.apache.jasper.JasperException: ...

随机推荐

  1. 关于C#低版本升级高版本时,项目中引用Microsoft.Office.Interop.Word,程序提示不存在类型或命名空间名office.

    Report.cs里using Microsoft.Office.Interop.Word;就会报错:编译器错误消息: CS0234: 命名空间“Microsoft.Office”中不存在类型或命名空 ...

  2. 将整个文件读入string中

    size_t GetFileSize(FILE* file) { fseek(file, , SEEK_END); return static_cast<size_t>(ftell(fil ...

  3. 三,Smarty模板技术/引擎——变量操作(2)

    1, 变量的分类 ① 从PHP中分配的变量,比如a.php跳转到b.php时候,可以在a.php中分配变量,b.tpl中直接调用.a.php中代码,$smarty->assign(‘str’,’ ...

  4. php 调用银联接口 【转载】

    首先要开启openssl开启方法为 openssl证书放在Apache的bin目录中. 其中的php_openssl.dll,ssleay32.dll,libeay32.dll,3个文件拷到windo ...

  5. Logstash使用grok解析IIS日志

    Logstash使用grok解析IIS日志 1. 安装配置 安装Logstash前请确认Elasticsearch已经安装正确,参见RedHat6.4安装Elasticsearch5.2.0. 下载链 ...

  6. jquery源码解析:jQuery原型方法init的详解

    先来了解几个jQuery方法: <li></li> <li></li> <li></li> $("li") ...

  7. Netty 5 获取客户端IP(非HTTP)

    使用Netty 5.0.0.Alpha2时,想知道客户端的ip以区分客户端,发现网上都是通过解析HTTP头域完成的,这里提供一种比较简单的方法. System.out.println("Cl ...

  8. 使用Filter解决登录中乱码问题

    使用Filter解决登录中乱码问题 衔接:https://www.cnblogs.com/zst18980621948/p/10654088.html 1.工作目录 新增Filter类 2.Login ...

  9. spring cloud知识点

    eureka注册中心(zookeeper,eureka) 也要集群,可以相互注册,网状结构.后面很多高可用的服务都是用这种方式.Eureka的客户端缓存技术 spring boot actuator ...

  10. Ubuntu 18.04 安装 odoo12 源码版

    更新和升级 在我们进入安装过程之前,你应该更新和升级Ubuntu.打开终端窗口,发出以下命令: sudo apt-get updatesudo apt-get upgrade 注意:如果内核升级,则必 ...