he Struts dispatcher cannot be found. This is usually caused by using Struts tags without the assoc

经常在使用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 for this tag. - [unknown location]


org.apache.jasper.JasperException: An exception occurred processing JSP page /login.jsp at line 68


65: </td>
66: </tr>
67: </table>
68: <font color="red" size="3"><s:property value="result"/></font>
69: <br/> 
70: </form>
71: 


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:521)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:430)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


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]
org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:60)
org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:44)
org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:48)
org.apache.jsp.login_jsp._jspx_meth_s_005fproperty_005f0(login_jsp.java:169)
org.apache.jsp.login_jsp._jspService(login_jsp.java:129)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


其实就是那个标签那里报错了。

那解决办法也很简单:只要将标签<s:property value="result"/>换成最简单的jsp标签就行了${result }


但是如果是一个list,就没有办法,归根结底还是struts的问题。参考点击打开链接


解决的办法:(4种解决方案)

1. 

web.xml 中添加一个filter 

<filter-mapping> 

<filter-name>struts2</filter-name> 

<url-pattern>*.jsp</url-pattern> 

</filter-mapping> 



<filter-mapping> 

<filter-name>struts2</filter-name> 

<url-pattern>/action/*</url-pattern> 

</filter-mapping> 


2. 


<filter-mapping> 


<filter-name>struts2</filter-name> 


<url-pattern>/*</url-pattern>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值