`

the struts dispatcher cannot be found

阅读更多
在struts2.0中直接访问jsp路径,有时候会出现这样的错误: Error 500--Internal Server Error 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:60) at org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:52) at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:49) at jsp_servlet._report.__customerinfo._jspService(__customerinfo.java:133) at weblogic.servlet.jsp.JspBase.service(JspBase.java:34) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:283) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42) at org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:99) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:42) at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3242) at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321) at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121) at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2010) at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1916) at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1366) at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209) at weblogic.work.ExecuteThread.run(ExecuteThread.java:181) 错误提示里已经说得很明白:这通常是由于不经由Filter访问包含struts标签的jsp页面导致的。那么,只要通过配置,使得对jsp页面的访问请求由Filter过滤转发即可。 方法1:在strut.xml中配置一个通用Action,通过这个Action转发到jsp页面。这个时候,原先访问jsp的请求路径就要换成相应的Action路径了。写法如下。 <action name="*"><result>/{1}.jsp</result></action> 方法2:在web.xml中配置Filter的url-parttern。写法如下。其中struts2-dispatcher 是已定义的Filter。 <filter-mapping><filter-name>struts2-dispatcher </filter-name><url-pattern>*.action </url-pattern></filter-mapping><filter-mapping><filter-name>struts2-dispatcher </filter-name><url-pattern>*.jsp </url-pattern></filter-mapping> 方法3:在web.xml中配置扩展名。写法如下。配置完成后,就可以这样访问了:http://localhost:8080/yk_cpp/public/index.html 在web.xml中加 <init-param><param-name>struts.action.extension</param-name><param-value>html</param-value></init-param> 在struts.xml中加 <constant name="struts.action.extension" value="html"></constant> 方法4:修改struts.properties文件。去struts2的包里看一下default.properties,里面默认的action是struts.action.extension=action,,(注意有两个逗号,意思是第二个配置是空)空是全部拦截。在这里修改要拦截的带扩展名的文件,比如struts.action.extension=action,jnlp,do 不过这些没有经过测试;因为我的本地服务器没有出500的错误,问题是出在正式服务器上的,所以没法调试。下次设法在本地重现一下问题,然后挨个试一试。
分享到:
评论

相关推荐

    org.apache.struts2.dispatcher.FilterDispatcher

    org.apache.struts2.dispatcher.FilterDispatcher

    Struts课堂笔记.rar--struts2的struts.properties配置文件详解

    The org.apache.struts2.dispatcher.multipart.MultiPartRequest parser implementation for a multipart request (file upload) 专为multipart请求信息使用的org.apache.struts2.dispatcher.multipart....

    struts2上传必备jar包,避免出现struts2的升级漏洞!自己吃亏后分享

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

    struts 2.2 api文档

    org.apache.struts2, org.apache.struts2.components, org.apache.struts2.components.template, org.apache.struts2.config, org.apache.struts2.dispatcher, org.apache.struts2.dispatcher.mapper, org.apache....

    Struts2.5.2的配置及问题解决

    针对Struts2.5.2最新版本的配置进行了梳理,通过一步步的步骤和发生的问题点的解决,完成对Struts2.5.2的配置。

    Struts2上传所需jar包

    that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different ...

    tomcat报错Unable to find 'struts multipart saveDir解决

    tomcat报错Unable to find 'struts multipart saveDir解决

    Struts2_s2-016&017&ognl2.6.11_patch漏洞补丁

    &lt;bean type="org.apache.struts2.dispatcher.mapper.ActionMapper" name="myDefaultActionMapper" class="com.struts2.MyDefaultActionMapper" /&gt; &lt;constant name="struts.mapper.class" value=...

    Struts2入门教程(全新完整版)

    org.apache.struts2.dispatcher.ServletActionRedirectResult 16 plainText 16 显示源文件内容,如文件源码 16 org.apache.struts2.dispatcher.PlainTextResult 16 freemarker 16 处理FreeMarker模板 16 org.apache....

    Laravel开发-dispatcher

    Laravel开发-dispatcher Laravel 5基于事件的请求和命令调度程序

    新struts2+jQuery所需包.rar

    &lt;filter-class&gt;org.apache.struts2.dispatcher.FilterDispatcher, 新版本中都是过时的了,采取该过滤器, &lt;filter-class&gt;org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter。

    第一个struts程序

    org.apache.struts2.dispatcher.FilterDispatcher dispatcher这个单词写错了。 3、LoginAction.java这个文件中的方法写错了。public String execute(),excecute这个单词写错了。 4、struts.xml中的...

    struts-2.5.13

    &lt;filter-class&gt;org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter&lt;/filter-class&gt; &lt;!-- 引用个具体类文件 --&gt; &lt;/filter&gt; &lt;filter-mapping&gt; &lt;filter-name&gt;struts2&lt;/filter-name&gt; ...

    Struts2属性文件详解

    struts.diSPAtcher.parametersWorkaround 对于某些Java EE服务器,不支持HttpServlet Request调用getParameterMap()方法,此时可以设置该属性值为true来解决该问题.该属性的默认值是false.对于 WebLogic、Orion和OC4J...

    struts-2.3.33-lib.zip

    struts2官网2.3版本的最后一个版本,能够...注意此版本的dispatcher是org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter。详见https://struts.apache.org/docs/struts-23-to-25-migration.html。

    struts 2.3.4.1 最新英文版API

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

    Apache的Struts2框架严重安全漏洞

    Apache的Struts2框架最近出了一个很严重的漏洞,可以直接执行系统命令 http://www.163.com?%28%27\u0023_memberAccess[\%27allowStaticMethodAccess\%27]%27%29%28meh%29=true&%28aaa%29%28%28%27\u0023context[\%27...

    struts2 + spring + mybatis 框架整合jar包

    &lt;filter&gt;&lt;filter-name&gt;struts2&lt;/filter-name&gt;&lt;filter-class&gt;org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter&lt;/filter-class&gt;&lt;/filter&gt;&lt;filter-mapping&gt;&lt;filter-name&gt;struts2&lt;/filter-name&gt;...

    struts2配置2.5版

    &lt;?xml version="1.0" encoding="UTF-8"?... org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter &lt;!-- 拦截所有的url --&gt; &lt;filter-name&gt;struts2 &lt;url-pattern&gt;/* &lt;/web-app&gt;

    传智播客struts2全程学习笔记

    传智播客struts2开源框架全程跟踪学习笔记,可以有效的提高对struts2框架的新认识和使用,更有效的提高开发效率!

Global site tag (gtag.js) - Google Analytics