java - Struts is taking incorrect return string. Instead of "input" it should take "success" -
this question has answer here:
i developing application using struts 2 , hibernate. have submit button on jsp page having action evaluaterating
jsp page
<s:form action="evaluaterating"> // jsp code here // <s:hidden name="year" value="2015" /> <s:submit value="evaluate" cssstyle="float:right"/> </s:form>
and action mapped in struts.xml
struts.xml
<action name="evaluaterating" class="action.ratingaction" method="evaluaterating"> <result name="success" type="redirectaction"> <param name="year">${year}</param> <param name="actionname">mgrpage</param> </result> <result name="input">/index.jsp</result> </action>
my evaluaterating()
method looks like:
ratingaction.java
public string evaluaterating() { this.setyear(this.getyear()); return "success"; }
issue facing have returned success
method, still taking input
return string , redirecting index.jsp
page. instead should take success
, redirect action mgrpage
.
and if don't write <result name="input">/index.jsp</result>
line in struts.xml. giving me following error:
struts problem report
struts has detected unhandled exception:
messages: no result defined action action.ratingaction , result input
stacktraces no result defined action action.ratingaction , result input com.opensymphony.xwork2.defaultactioninvocation.executeresult(defaultactioninvocation.java:373) com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:275) 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:246) com.opensymphony.xwork2.interceptor.conversionerrorinterceptor.intercept(conversionerrorinterceptor.java:138) com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) com.opensymphony.xwork2.interceptor.parametersinterceptor.dointercept(parametersinterceptor.java:239) com.opensymphony.xwork2.interceptor.methodfilterinterceptor.intercept(methodfilterinterceptor.java:98) com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) com.opensymphony.xwork2.interceptor.parametersinterceptor.dointercept(parametersinterceptor.java:239) com.opensymphony.xwork2.interceptor.methodfilterinterceptor.intercept(methodfilterinterceptor.java:98) com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) com.opensymphony.xwork2.interceptor.staticparametersinterceptor.intercept(staticparametersinterceptor.java:191) com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) org.apache.struts2.interceptor.multiselectinterceptor.intercept(multiselectinterceptor.java:73) com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) org.apache.struts2.interceptor.checkboxinterceptor.intercept(checkboxinterceptor.java:91) com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) org.apache.struts2.interceptor.fileuploadinterceptor.intercept(fileuploadinterceptor.java:252) com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) com.opensymphony.xwork2.interceptor.modeldriveninterceptor.intercept(modeldriveninterceptor.java:100) com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) com.opensymphony.xwork2.interceptor.scopedmodeldriveninterceptor.intercept(scopedmodeldriveninterceptor.java:141) com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) com.opensymphony.xwork2.interceptor.chaininginterceptor.intercept(chaininginterceptor.java:145) com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) 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:246) com.opensymphony.xwork2.interceptor.i18ninterceptor.intercept(i18ninterceptor.java:161) com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) org.apache.struts2.interceptor.servletconfiginterceptor.intercept(servletconfiginterceptor.java:164) com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) com.opensymphony.xwork2.interceptor.aliasinterceptor.intercept(aliasinterceptor.java:193) com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) com.opensymphony.xwork2.interceptor.exceptionmappinginterceptor.intercept(exceptionmappinginterceptor.java:189) com.opensymphony.xwork2.defaultactioninvocation.invoke(defaultactioninvocation.java:246) org.apache.struts2.impl.strutsactionproxy.execute(strutsactionproxy.java:54) org.apache.struts2.dispatcher.dispatcher.serviceaction(dispatcher.java:563) org.apache.struts2.dispatcher.ng.executeoperations.executeaction(executeoperations.java:77) org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter.dofilter(strutsprepareandexecutefilter.java:99) org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:239) org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:206) org.apache.catalina.core.standardwrappervalve.invoke(standardwrappervalve.java:219) org.apache.catalina.core.standardcontextvalve.invoke(standardcontextvalve.java:106) org.apache.catalina.authenticator.authenticatorbase.invoke(authenticatorbase.java:501) org.apache.catalina.core.standardhostvalve.invoke(standardhostvalve.java:142) org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:79) org.apache.catalina.valves.abstractaccesslogvalve.invoke(abstractaccesslogvalve.java:610) org.apache.catalina.core.standardenginevalve.invoke(standardenginevalve.java:88) org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:537) org.apache.coyote.http11.abstracthttp11processor.process(abstracthttp11processor.java:1085) org.apache.coyote.abstractprotocol$abstractconnectionhandler.process(abstractprotocol.java:658) org.apache.coyote.http11.http11nioprotocol$http11connectionhandler.process(http11nioprotocol.java:222) org.apache.tomcat.util.net.nioendpoint$socketprocessor.dorun(nioendpoint.java:1556) org.apache.tomcat.util.net.nioendpoint$socketprocessor.run(nioendpoint.java:1513) java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run(taskthread.java:61) java.lang.thread.run(thread.java:745)
its seems interceptor applying before action , return input result.
check , remove interceptor on action.
Comments
Post a Comment