当前位置: 代码迷 >> Web前端 >> Struts报错误The Struts dispatcher cannot be found. This is usually caused by using Struts tags without
  详细解决方案

Struts报错误The Struts dispatcher cannot be found. This is usually caused by using Struts tags without

热度:616   发布时间:2013-10-21 17:00:48.0
Struts报异常The Struts dispatcher cannot be found. This is usually caused by using Struts tags without

经常在使用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 }


  相关解决方案