日期:2014-05-20  浏览次数:20855 次

struts2 异常问题
我是个struts2 的初学者 
这个就是一个简单的验证提交是否为空的程序 我在学校做好并且测试成功了!
但拿到家里运行 就出现一下异常!
type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

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

24: </head>
25:  
26: <body>
27: <s:form action="ss.action" method="post">
28: <s:textfield label="label.name" name="name"></s:textfield>
29: <s:password label="label.password" name="password"></s:password>
30: <s:submit value="ok"></s:submit>


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:524)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:435)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


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:52)
org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:49)
org.apache.jsp.login_jsp._jspx_meth_s_005fform_005f0(login_jsp.java:126)
org.apache.jsp.login_jsp._jspService(login_jsp.java:97)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


note The full stack trace of the root cause is available in the Apache Tomcat/6.0.14 logs.

我的 login.jsp的代码是

  <body>
<s:form action="ss.action" method="post">
<s:textfield label="label.name" name="name"></s:textfield>
<s:password label="label.password" name="password"></s:password>
<s:submit value="ok"></s:submit>
</s:form> 
  </body>
我的struts.xml 是
<struts>
<constant name="struts.custom.i18n.resources" value="mypack.res" />
<package name="mystrutsweb" extends="struts-default">
<action name="ss" class="mypack.LoginAction">
<result name="success">/welcome.jsp</result>
<result name="input">/login.jsp</result>
</action>
</package>
</struts>













------解决方案--------------------
怎么跟我学的STRUTS不一样啊,应该有个formbean吧,而且,Action的Path应该跟jsp中form的action一致
------解决方案--------------------
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