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>
==========================================================