如何向 Struts 2 添加操作

问题描述 投票:0回答:2
java jsp configuration struts2 action-mapping
2个回答
2
投票
Stacktraces No result defined for action actions.agenda and result input com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:376) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:278) com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265) org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:211) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:211) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:190) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:75) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:90) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:243) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171) com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:176) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:192) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:187) com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:249) org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54) org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:511) org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:432) org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256) org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:217) org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279) org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655) org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595) org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161) org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231) com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317) com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195) com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860) com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757) com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056) com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229) com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) com.sun.grizzly.ContextTask.run(ContextTask.java:71) com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) java.lang.Thread.run(Thread.java:722)

。 基本上,这意味着某些原因导致 Struts 认为您向其中一个属性提供了无效数据(或者验证方法添加了字段/操作错误)。


例如也许您有一个设置器,它接受一个整数,并将一个非整数值传递给它,类似的东西。 因为它无法将提供的值转换为适合 setter 的值,所以它会抱怨。

这会导致操作返回“INPUT”值,而您没有为其定义结果。 通常,这里要做的是返回保存“输入”结果之前呈现的相同表单,因为正常的 Struts 2 标签(如

No result defined for action actions.agenda and result input

<s:textfield>
)将在相应字段上方显示字段错误。
    


1
投票
<s:select>

类型的结果。所以


input

	
© www.soinside.com 2019 - 2024. All rights reserved.