struts2只对于chrome报错的问题

先上报错代码,很简单,就是没有引用标签的一样的报错:

 

[Log] 2012-09-22 20:42:00,256 - WARN  -552225 [http-80-1] com.opensymphony.xwork2.util.logging.commons.CommonsLogger.warn(CommonsLogger.java:45) - Could not find property [org.apache.catalina.jsp_file]
 2012-9-22 20:42:00 org.apache.catalina.core.ApplicationDispatcher invoke
严重: Servlet.service() for servlet jsp threw exception
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:44)
    at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:48)
    at org.apache.jsp.web._404_jsp._jspx_meth_s_005fbean_005f0(_404_jsp.java:307)
    at org.apache.jsp.web._404_jsp._jspx_meth_c_005fif_005f1(_404_jsp.java:252)
    at org.apache.jsp.web._404_jsp._jspService(_404_jsp.java:130)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:438)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
    at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:424)
    at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:343)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:144)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Unknown Source)
2012-9-22 20:42:00 org.apache.catalina.core.StandardHostValve custom
严重: Exception Processing ErrorPage[errorCode=404, location=/web/404.jsp]
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, which initializes the Struts dispatcher needed for this tag. - [unknown location]
    at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:416)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:438)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
    at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:424)
    at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:343)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:144)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Unknown Source)
Caused by: 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:44)
    at org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:48)
    at org.apache.jsp.web._404_jsp._jspx_meth_s_005fbean_005f0(_404_jsp.java:307)
    at org.apache.jsp.web._404_jsp._jspx_meth_c_005fif_005f1(_404_jsp.java:252)
    at org.apache.jsp.web._404_jsp._jspService(_404_jsp.java:130)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
    ... 19 more

 

 

 

测试代码:

 

<link type="text/css" rel="stylesheet" href="/css/home_left.css" />
<div id="u_pic"></div>

 

是的 没错 页面精简这样了都还是报上面的错误,并且只有在chrome里面才会报错;各位有谁遇到这中蛋疼的问题或者知道这是什么引起的请赐教下!谢谢!

jinnianshilongnian
jinnianshilongnian 请把struts2拦截器配置贴出
7 年多之前 回复

4个回答

1、你有一个404.jsp 里边使用了struts2标签 但这个jsp没有走struts2拦截器
2、即../images/u.png 没有在服务器找到 404造成的

poterban
放牛二班长 是我理解错了,你说的是对的,就是你上面说的那样。很感谢,问题解决了! 希望大家能有所参考; 结贴了。
7 年多之前 回复
jinnianshilongnian
jinnianshilongnian at org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:60) 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.web._404_jsp._jspx_meth_s_005fbean_005f0(_404_jsp.java:307) at org.apache.jsp.web._404_jsp._jspx_meth_c_005fif_005f1(_404_jsp.java:252) at org.apache.jsp.web._404_jsp._jspService(_404_jsp.java:130) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) 可以看一下 异常栈是没走的,因为发生404 是执行了request.forward到404.jsp页面的 因此如果想要404.jsp走struts2拦截器可以配置 <dispatcher>FORWARD</dispatcher> <dispatcher>REQUEST</dispatcher> //默认 <dispatcher>INCLUDE</dispatcher>
7 年多之前 回复
poterban
放牛二班长 应该有问题,因为根据我上面的配置,进入404页面是走了struts2过滤器的,实际中进入404页面时标签也是完整的执行的; 另外:试过了很多次,其他的浏览器都没有问题(也说明是过了struts2过滤器的),就是chrome有问题。
7 年多之前 回复
jinnianshilongnian
jinnianshilongnian 2、../images/u.png 改成根相对地址 不要使用相对地址(上下文/路径) 这个会根据地址栏中地址计算 不准
7 年多之前 回复
jinnianshilongnian
jinnianshilongnian 1、 当发生404/500 会定位到404.jsp 此时不会走struts2过滤器 因此不要再404.jsp中使用任何struts2标签 使用c标签吧 <error-page> <error-code>404</error-code> <location>/web/404.jsp</location> </error-page> <error-page> <error-code>500</error-code> <location>/web/404.jsp</location> </error-page>
7 年多之前 回复
poterban
放牛二班长 web.xml补充了
7 年多之前 回复
jinnianshilongnian
jinnianshilongnian 具体贴一下web.xml
7 年多之前 回复
poterban
放牛二班长 404.jsp是什么原因导致不走拦截器,怎么解决?为什么其他浏览器没有报错呢 能说详细些吗 很谢谢~
7 年多之前 回复

[url]http://blog.csdn.net/icejadelove/article/details/4659614[/url]

可以参考下在这个,可能是你web.xml配置忘配置了。

poterban
放牛二班长 已贴了
7 年多之前 回复
zx527291227
zx527291227 顺便struts.xml也贴下
7 年多之前 回复
zx527291227
zx527291227 <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> 配置了吗?方便的话web.xm代码贴出来下
7 年多之前 回复
poterban
放牛二班长 配置了的
7 年多之前 回复

1、你有一个404.jsp 里边使用了struts2标签 但这个jsp没有走struts2拦截器
2、即../images/u.png 没有在服务器找到 404造成的

你的struts-cleanup对应的是.action ,但Struts2却对应/

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问