3
回答
关于struts2 ” .action ”的困惑???
利用AWS快速构建适用于生产的无服务器应用程序,免费试用12个月>>>   

用Struts2的校验框架进行数据校验时,在jsp页面这样写:

<s:form action="login" validate="true" >

        ...    ...

</s:form>

它给我报错,加上”.action”后,

<s:form action="login.action" validate="true" >

        ...    ...

</s:form>

就一切正常了!!一下是错误提示:

严重: 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@c278b5

 

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@c278b5

The problematic instruction:

----------

==> list tag.getValidators("${tagName}") as validator [on line 46, column 9 in template/xhtml/form-close-validate.ftl]

 in include "/${parameters.templateDir}/xhtml/form-close-validate.ftl" [on line 25, column 1 in template/xhtml/form-close.ftl]

----------

 

Java backtrace for programmers:

----------

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@c278b5

at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:130)

at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93)

at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)

at freemarker.core.IteratorBlock.accept(IteratorBlock.java:94)

at freemarker.core.Environment.visit(Environment.java:210)

at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:167)

at freemarker.core.Environment.visit(Environment.java:417)

at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)

at freemarker.core.Environment.visit(Environment.java:210)

at freemarker.core.MixedContent.accept(MixedContent.java:92)

at freemarker.core.Environment.visit(Environment.java:210)

at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)

at freemarker.core.Environment.visit(Environment.java:210)

at freemarker.core.MixedContent.accept(MixedContent.java:92)

at freemarker.core.Environment.visit(Environment.java:210)

at freemarker.core.Environment.include(Environment.java:1483)

at freemarker.core.Include.accept(Include.java:169)

at freemarker.core.Environment.visit(Environment.java:210)

at freemarker.core.MixedContent.accept(MixedContent.java:92)

at freemarker.core.Environment.visit(Environment.java:210)

at freemarker.core.Environment.process(Environment.java:190)

at freemarker.template.Template.process(Template.java:237)

at org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:157)

at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:559)

at org.apache.struts2.components.UIBean.end(UIBean.java:513)

at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)

at org.apache.jsp.login_jsp._jspx_meth_s_005fform_005f0(login_jsp.java:184)

at org.apache.jsp.login_jsp._jspService(login_jsp.java:96)

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:388)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)

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.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:389)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:102)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

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:291)

at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:877)

at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:594)

at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675)

at java.lang.Thread.run(Thread.java:619)

Caused by: java.lang.NullPointerException

at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.buildValidatorKey(AnnotationActionValidatorManager.java:212)

at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValidators(AnnotationActionValidatorManager.java:69)

at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValidators(AnnotationActionValidatorManager.java:65)

at org.apache.struts2.components.Form.getValidators(Form.java:265)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:840)

at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:106)

... 51 more

2012-4-19 2:05:33 org.apache.catalina.core.StandardWrapperValve invoke

严重: Servlet.service() for servlet jsp threw exception

java.lang.NullPointerException

at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.buildValidatorKey(AnnotationActionValidatorManager.java:212)

at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValidators(AnnotationActionValidatorManager.java:69)

at com.opensymphony.xwork2.validator.AnnotationActionValidatorManager.getValidators(AnnotationActionValidatorManager.java:65)

at org.apache.struts2.components.Form.getValidators(Form.java:265)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:597)

at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:840)

at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:106)

at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93)

at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)

at freemarker.core.IteratorBlock.accept(IteratorBlock.java:94)

at freemarker.core.Environment.visit(Environment.java:210)

at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:167)

at freemarker.core.Environment.visit(Environment.java:417)

at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)

at freemarker.core.Environment.visit(Environment.java:210)

at freemarker.core.MixedContent.accept(MixedContent.java:92)

at freemarker.core.Environment.visit(Environment.java:210)

at freemarker.core.ConditionalBlock.accept(ConditionalBlock.java:79)

at freemarker.core.Environment.visit(Environment.java:210)

at freemarker.core.MixedContent.accept(MixedContent.java:92)

at freemarker.core.Environment.visit(Environment.java:210)

at freemarker.core.Environment.include(Environment.java:1483)

at freemarker.core.Include.accept(Include.java:169)

at freemarker.core.Environment.visit(Environment.java:210)

at freemarker.core.MixedContent.accept(MixedContent.java:92)

at freemarker.core.Environment.visit(Environment.java:210)

at freemarker.core.Environment.process(Environment.java:190)

at freemarker.template.Template.process(Template.java:237)

at org.apache.struts2.components.template.FreemarkerTemplateEngine.renderTemplate(FreemarkerTemplateEngine.java:157)

at org.apache.struts2.components.UIBean.mergeTemplate(UIBean.java:559)

at org.apache.struts2.components.UIBean.end(UIBean.java:513)

at org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)

at org.apache.jsp.login_jsp._jspx_meth_s_005fform_005f0(login_jsp.java:184)

at org.apache.jsp.login_jsp._jspService(login_jsp.java:96)

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:388)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)

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.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:389)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:102)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

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:291)

at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:877)

at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:594)

at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675)

at java.lang.Thread.run(Thread.java:619)

困惑:为什么此处加要上.action?

举报
顶部