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. python之爬虫(二)爬虫的原理

    在上文中我们说了:爬虫就是请求网站并提取数据的自动化程序.其中请求,提取,自动化是爬虫的关键!下面我们分析爬虫的基本流程 爬虫的基本流程 发起请求通过HTTP库向目标站点发起请求,也就是发送一个Req ...

  2. 升级Linux中的JAVA版本

    首先查看本机中的JAVA版本 如何需要卸载掉现有的JAVA版本的话,可以使用rpm -qa | grep java 和 rpm -e xxx --nodeps进行卸载 登录到JAVA官方下载界面,提供 ...

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

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

  4. [转] Linux 安装.src.rpm源码包的方法

    方法一:以setarch-1.3-1.src.rpm 软件包为例(可以到CSDN http://download.csdn.net/source/215173#acomment下载) 假设该文件已经存 ...

  5. Maven 远程仓库下载慢的的解决方案

    配置很简单,修改conf文件夹下的settings.xml文件,添加如下镜像配置: 我直接去设置maven目录下面的setttings文件 添加镜像站点 <mirrors> <mir ...

  6. TD-LTE技术原理与系统设计

    王映民 等.人邮2010 E-UTRAN E-NodeB 无线资源管理承载 路由到SGW IP头压缩加密 UE附着MME选择 寻呼 广播 测量 EPC SGW 移动性管理  路由转发 终止寻呼 监听 ...

  7. linux 查看进程启动时,用户的工作目录

    在linux下查看进程大家都会想到用 ps -ef|grep XXX可是看到的不是全路径,怎么看全路径呢?每个进程启动之后在 /proc下面有一个于pid对应的路径例如:ps -ef|grep pyt ...

  8. JavaWeb——Servlet如何调用线程池中的线程?

    tomcat线程池与servlet https://blog.csdn.net/qq_27817797/article/details/54025173 https://blog.csdn.net/l ...

  9. c# 线程,同步,锁

    最近在阅读<c#高级编程> 这本书.记录一下关于锁的使用 大致分为三种方法: 方法1:使用 lock 方法2:使用 Interlocked 方法3:使用 Monitor using Sys ...

  10. Python操作Excel(将父子级表头生成树状结构)

    import re class Node: ''' 容器,用来存储前后节点信息 ''' __slot__=[] def __init__(self,val,next_,pre,name,no): se ...