I am migrating from struts 1 to struts 2 framework. Based on struts 1 framework parameter=method attribute, I am able to execute different methods using the same jsp page by adding a hidden field "method".
How do I achieve the same in struts 2?
My Action class:
public class MyAction extends ActionSupport {
public String methodA() {
return "a";
}
public String methodB() {
return "b";
}
}
My JSP page
<s:form action="MyAction">
<s:select label="Method Name"
name="method"
headerKey="-1" headerValue="Select Method"
list="#{'01':'A', '02':'B', [...]}"
value="selectedMethod"
required="true"
/>
<s:submit type="button" name="submit" />
</s:form>