configurationstruts2action-mapping

No result defined for action [] and result input


I have a question about actions on Struts 2.

Suppose I have a form with the action "save".

And I have mapped on my struts.xml that action to some method, like this:

<action name="save" class="actions.agenda" method="save">
            <result name="success">/agenda/success.jsp</result>
        </action>

In my Action class I use the execute method to load some parameters in the form, so I have created the method to save the new entry:

public String save(){
        ///Logic here
        dao.create(entry)
        return SUCCESS;
    }

The problem is I'm having this error:

SEVERE: Could not find action or result

Can someone give me clues about this problem ?

web.xml

<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    </filter>
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    
    
    <filter>
    <filter-name>springOpenEntityManagerInViewFilter</filter-name>
    <filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>
    <init-param>
      <param-name>entityManagerFactoryBeanName</param-name>
      <param-value>entityManagerFactory</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>springOpenEntityManagerInViewFilter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>

    
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>

.....

</web-app>

I have my action (save) on an separate xml, called Actions.xml, and it is included in struts.xml.

Stacktrace

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)
    

other actions works fine.


Solution

  • The complaint that you're actually getting is No result defined for action actions.agenda and result input. Basically this means that something caused Struts to believe you're providing invalid data to one of the properties (or the validate method added a field/action error).

    e.g. Maybe you have a setter that takes an integer that you're passing a non-integer value to, something like that. Because it can't do the conversion from the provided value to one appropriate for the setter, it'll complain.

    This causes the action to return a value of 'INPUT', for which you have no result defined. Usually what would be done here is return the same form that was presented before the save for 'input' results, as the normal Struts 2 tags, like <s:textfield> or <s:select> will display field errors above the corresponding fields.