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. jquery源码解析:jQuery工具方法when详解

    我们先来看when方法是如何使用的: var cb = $.when();   //when方法也是返回一个延迟对象,源码是return deferred.promise();返回的延迟对象不能修改状 ...

  2. jquery事件一 ---鼠标移入移出

    比较一下几个jquery事件的区别 mouseover() 鼠标进入(进入子元素也触发) mouseout() 鼠标离开(离开子元素也触发) mouseenter() 鼠标进入(进入子元素不触发) m ...

  3. 渐进增强 VS 优雅降级

    渐进增强(Progressive Enhancement):一开始就针对低版本浏览器进行构建页面,完成基本的功能,然后再针对高级浏览器进行效果.交互.追加功能达到更好的体验. 优雅降级(Gracefu ...

  4. leetcode-819-Most Common Word(词频统计)

    题目描述: Given a paragraph and a list of banned words, return the most frequent word that is not in the ...

  5. leetcode-747-Largest Number At Least Twice of Others(求vector的最大值和次大值)

    题目描述: In a given integer array nums, there is always exactly one largest element. Find whether the l ...

  6. 2016级算法第二次上机-A.画个圈圈诅咒你

    890 画个圈圈诅咒你 思路 简单题.题目中的圆并没有什么实际作用,简化成线段重合问题会更好理解些. 暴力解法:使用双重for循环会T到想哭,记住最直接的方法一般是过不了题的. 解法一:二分查找.空间 ...

  7. Hibernate 初识

    第一步: 导包:(这是我根据其他网站的介绍导入的包,可能不完善,但开发没什么问题,遇到问题再说) 当然还有mysql的jar包 第二步:进行hibernate环境配置 在classpath目录下建立h ...

  8. elasticsearch kibana简单查询

    kibana CRUD 操作页面 一.简单的CRUD操作 1.添加 PUT /index/type/id {  "json数据" } 2.查询 GET /index/type/id ...

  9. Angular material mat-icon 资源参考_Hardware

    ul,li>ol { margin-bottom: 0 } dt { font-weight: 700 } dd { margin: 0 1.5em 1.5em } img { height: ...

  10. selectComponent是ok的,小程序组件 component方式,让子页面重绘

    this.selectComponent('#news').init(); 其中news是父级xml文件引用子组件的时给子组件的id. 当父级传给子级的数据有变化时,需要子页面重绘,所以就用上面那行代 ...