Dynamic Method invocation is the concept in the Struts action mapping file, where instead of writing <action> for every method, one can map the wild character with the method name having same prefix or suffix.
Example : Instead of writing addOperation, subOperation and divOperation, programmer can write *Operation.
Consider below jsp code:
<s:form action="calculator_add" > <s:textfield name="num1" label="Number 1"></s:textfield> <s:textfield name="num2" label="Number 2"></s:textfield> <s:submit action="calculator_add" value="Add" /> <s:submit action="calculator_sub" value="Substract" /> </s:form>
Continue reading “Explain dynamic method invocation in Struts 2”