Personally I would consider Struts to be legacy and I would migrate to using Spring as soon as you can.
If you use the latest Spring boot for example, you can do away with all those nasty XML files which are cumbersome at best. Then you can start to use annotations for all you configuration, dependency injection etc.
Baz Edwards wrote:Personally I would consider Struts to be legacy
Struts 2.5 is under active development, so I wouldn't call it "legacy". Struts certainly isn't as popular as it used to be.
Baz Edwards wrote:
If you use the latest Spring boot
Spring Boot is a totally different animal. It is a stand-alone application server and framework in one. Struts is more akin to Spring MVC alone. If one just needs a front controller, Struts will work just fine. Struts can also be configured to use Spring to inject code into Struts actions, so they aren't necessarily exclusive.
I actually prefer XML configuration files to annotations as it is easier to find the configuration information in one place, rather than hunting around in Java source code.
As for Abhishek's question, no, you cannot configure one action tag to correspond to multiple methods. The purpose of the action tag is to map a particular web request to a particular method, so that wouldn't make sense.
If you are looking to avoid writing a ton of XML, look at the Convention Plugin. It allows one to specify a method name in a particular way and the plugin does the work of the working out the mapping. It also supports a bunch of annotations to configure the various options available in the action XML tag.