sturts2.1.8.1 validate="true" jsp 编译报错
login.jsp
<s:form action="login" validate="true">
<s:textfield name="username" label="用户名"/>
<s:password name="password" label="密 码"/>
<input type="submit" value="确定"/>
</s:form>
---------------------------------------------------
struts.xml
<action name="login" class="com.study.struts.action.LoginAction">
<result name="input">/login.jsp</result>
<result name="success">/success.jsp</result>
<result name="error">/error.jsp</result>
</action>
---------------------------------------------------
LoginAction-validation.xml
<!-- 校验规则定义的根元素 -->
<validators>
<field name="username">
<field-validator type="requiredstring">
<message>请输入用户名</message>
</field-validator>
</field>
<field name="password">
<field-validator type="requiredstring">
<message>请输入密码</message>
</field-validator>
</field>
</validators>
不知道大家有没有遇到过这种写法交给struts2去校验信息时抛出JSP500错误错误代码如下 请问各位有解决方案么
type Exception report
message
description
The server encountered an internal error () that prevented it from fulfilling this request.exception
org.apache.jasper.JasperException: Method public java.util.List org.apache.struts2.components.Form.getValidators(java.lang.String) threw an exception when invoked on org.apache.struts2.components.Form@12e7cb6 - Class: freemarker.ext.beans.SimpleMethodModel
File: SimpleMethodModel.java
Method: exec
Line: 130 - freemarker/ext/beans/SimpleMethodModel.java:130:-1
org.apache.jasper.servlet.JspServletWrapper.handle
JspException(JspServletWrapper.java:541)
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)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:389)
root cause
Method public java.util.List org.apache.struts2.components.Form.getValidators(java.lang.String) threw an exception when invoked on org.apache.struts2.components.Form@12e7cb6 - Class: freemarker.ext.beans.SimpleMethodModel
File: SimpleMethodModel.java
Method: exec
Line: 130 - freemarker/ext/beans/SimpleMethodModel.java:130:-1
org.apache.struts2.components.UIBean.end(UIBean.java:515)
org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
org.apache.jsp.login_jsp._jspx_meth_s_005fform_005f0(login_jsp.java:130)
org.apache.jsp.login_jsp._jspService(login_jsp.java:72)
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)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:389)
root cause
freemarker.template.TemplateModelException: Method public java.util.List org.apache.struts2.components.Form.getValidators(java.lang.String) threw an exception when invoked on org.apache.struts2.components.Form@12e7cb6
freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:130)