struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hernan gonzalez <hgonza...@gmail.com>
Subject Submit with several methods in Struts 2.2
Date Mon, 13 Sep 2010 18:46:16 GMT
This pattern ("submit" tag with method specified)
http://struts.apache.org/2.2.1/docs/html-form-buttons-howto.html
worked for me in my previous version (from Struts 2.1.6).
Now (in Struts 2.2.1), I can't make it work. It always calls "execute".
The only workaround I found was to set DynamicMethodInvocation=true (which
is discouraged in the docs, and was not necesary before).
Is this some documented change? Did I miss something?

Regards

HernĂ¡n

===================== sample code / configuration ================

public class TestMethodAction extends ActionSupport {
    private String param1 ="";

    public String myMethod() throws Exception {
        addActionMessage("Testing myMethod");
        return SUCCESS;
    }
    // setters / getters ....
}


and my Jsp:

<s:form>
 <s:textfield name="param1" label="Write something" />
 <s:submit value="Test" method="myMethod" />
 </s:form>
 <s:property value="param1"/>  <!-- for testing if the Param has been read
(this works ok)-->


Debug console info:


DEBUG [http-8080-1] org.apache.struts2.interceptor.FileUploadInterceptor
debug- Bypassing /test/TestMethod
DEBUG [http-8080-1]
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor
debug- Validating /test/TestMethod with method execute.

DEBUG [http-8080-1] org.apache.struts2.dispatcher.ServletDispatcherResult
debug- Forwarding to location /jsp/test/TestMethod.jsp
DEBUG [http-8080-1] org.apache.struts2.components.UIBean debug- Rendering
template /template/xhtml/actionmessage

struts.xml:

...
    <constant name="struts.enable.DynamicMethodInvocation" value="false" />
    <constant name="struts.devMode" value="true" />
   ...
      <action name="TestMethod" class="myproject.struts2.TestMethodAction">
            <result>/jsp/test/TestMethod.jsp</result>
     </action>

==========================================================

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message