This is usually caused by using Struts tags without the associated filter.

1、错误描述

严重: Servlet.service() for servlet [jsp] in context with path [/SendMail] threw exception [An exception occurred processing JSP page /pages/fileupload/fileUpload.jsp at line 42

39:     <table>
40:        <tr>
41:          <td>
42:            <s:fielderror cssStyle="color:red"></s:fielderror>
43:          </td>
44:        </tr>
45:     </table>

Stacktrace:] with root cause
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. - [unknown location]
	at org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:58)
	at org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:44)
	at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:48)
	at org.apache.jsp.pages.fileupload.fileUpload_jsp._jspx_meth_s_005ffielderror_005f0(fileUpload_jsp.java:224)
	at org.apache.jsp.pages.fileupload.fileUpload_jsp._jspService(fileUpload_jsp.java:152)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:431)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:396)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:340)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:668)
	at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:223)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1517)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1474)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)

2、错误原因

没有在web.xml中配置struts2过滤器,struts2派发没有找到,导致出错

3、解决办法

在web.xml中配置:

<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>

版权声明:本文为博主原创文章,未经博主允许不得转载。

时间: 2024-12-17 08:45:18

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

对于struts2中的问题: org.apache.jasper.JasperException: 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, wh

struts(tags)

Struts2-tags 通用标签: property 默认的value 的类型为object,只要是object  类型都会被解析成ognl表达式,但是如果只想传递一个普通的字符串需要加'' ;example <s:property value="username" />会被解析成ognl表达式 <s:proerty value="'username'" />此时的username就是一个普通的字符串 设定默认值: <s:proper

Struts学习第一课 使用Filter作为控制器的MVC应用

MVC设计模式概览 实现MVC(Model,View,Controller)模式的应用程序由3大部分构成: -模型:封装应用程序的数据和业务逻辑(POJO,Plain Old Java Object) -视图,实现应用程序的信息显示功能(Jsp) -控制器,接收来自用户的输入,调用模型层,,响应对应的视图组件Servlet,Filter. 下面看代码: index.jsp <%@ page language="java" contentType="text/html;

struts的异常处理

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

struts2错误:The Struts dispatcher cannot be found.

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 t

struts2学习笔记--使用Validator校验数据

我们在进行一些操作是需要对用户的输入数据进行验证,比如网站的注册,需要对各个数据项进行数据校验,Struts2提供了一些默认的校验器,比如数字的检测,邮箱的检测,字符串长度的检测等等. 常用的Validator 校验器 作用  required  必填校验器,要求字段必须有值  requiredstring 必填字符串校验器,要求必须有值且长度大于0,即不能是空字符串.默认会去掉字符串前后空格 参数fieldName:该参数指定校验的字段名称,如果是字段校验,则不用指定该参数 参数trim:该参

Struts2学习之文件上传/下载&amp;ValueStack(三)

简介 今天是学习Struts2第三天,也算struts2准备前奏告一段落,提升部分只能在后期深入了解,多看源码,多参阅资料.今天所学的知识点文件上传.下载/ValueStack&OGNL/Struts2标签 文件上传/下载 文件上传简介 a). 企业常用文件上传技术 : jspSmartUpload(主要应用 JSP model1 时代) . fileupload (Apache commons项目中一个组件). Servlet3.0 集成文件上传 Part类 b). Struts2 对文件上传

struts2国际化全例 错误解决

在struts2中需要做国际化的有: jsp页面的国际化,action错误信息的国际化,转换错误信息的国际化,校验错误信息的国际化 在之前的例子中已经做过和国际化相关的例子了,在struts.xml中配置过 view plaincopy to clipboardprint? <constant name="struts.custom.i18n.resources" value="message"></constant> 其中的message就

Struts2实现文件上传报错(一)

1.具体报错如下 2014-5-1 23:02:38 org.apache.catalina.core.StandardWrapperValve invoke 严重: Servlet.service() for servlet [jsp] in context with path [/UploadFile] threw exception [An exception occurred processing JSP page /file.jsp at line 28 25: <table> 26