异常信息: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 的标签。
分享到:
相关推荐
at org.apache.struts2.dispatcher.Dispatcher.cleanUpRequest(Dispatcher.java:837) at org.apache.struts2.dispatcher.ng.PrepareOperations.cleanupRequest(PrepareOperations.java:103) at org.apache.struts2....
struts2官网2.3版本的最后一个版本,能够...注意此版本的dispatcher是org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter。详见https://struts.apache.org/docs/struts-23-to-25-migration.html。
at javax.servlet.http.HttpServletResponseWrapper.sendError(HttpServletResponseWrapper.java:108) at org.apache.struts2.dispatcher.Dispatcher.sendError(Dispatcher.java:770) at org.apache.struts2....
The org.apache.struts2.dispatcher.multipart.MultiPartRequest parser implementation for a multipart request (file upload) 专为multipart请求信息使用的org.apache.struts2.dispatcher.multipart....
org.apache.struts2.dispatcher.FilterDispatcher
org.apache.struts2.dispatcher.ng, org.apache.struts2.dispatcher.ng.filter, org.apache.struts2.dispatcher.ng.listener, org.apache.struts2.dispatcher.ng.servlet, org.apache.struts2.impl, org.apache....
针对Struts2.5.2最新版本的配置进行了梳理,通过一步步的步骤和发生的问题点的解决,完成对Struts2.5.2的配置。
org.apache.struts2.dispatcher.ng This package contains a reimagining of the traditional Struts filter dispatchers. org.apache.struts2.dispatcher.ng.filter org.apache.struts2.dispatcher.ng.listener ...
严重: Exception starting filter struts2 java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
官网对struts2的2.5版本做了一些修改,包括dispatcher(org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter)等,详见https://struts.apache.org/docs/struts-23-to-25-migration.html。
- The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: E:\Java\jre1.5.0_17\bin;.; - Initializing Coyote ...
<?xml version="1.0" encoding="UTF-8"?... org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter <!-- 拦截所有的url --> <filter-name>struts2 <url-pattern>/* </web-app>
The content of this document is organized on the basis of the initialization files where the parameters occur: global.ini attributes.ini daemon.ini esserver.ini executor.ini ...
在web.xml的display-name标签与welcome-file-list标签中加入一下代码 struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter struts2 /* org.springframework.web.context....
The SAP Web Dispatcher ................................................................. 71 Load Balancing in the SAP NetWeaver AS Java Environment....................... 98 Unit 2: Basics of User ...
本人辛苦整理的笔记~
plexus-sec-dispatcher-1.3.jar
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher, 新版本中都是过时的了,采取该过滤器, <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter。
The standard usage of akZoom is "on demand", this means you have to call akZoom explicitly after plotting something like shown in the akZoom_examples.m file. However, if you are satisfied with the ...
You can improve the performance of your code by using exact name matches and we therefore recommend that you update your usage accordingly. Alternatively, you can disable this warning using warning('...