I've always used XML, and I've started recently using Convention.
I would now say that you can still use XML, but it would be better to use Annotations.
The facts in support to this are that, with Convention plugin;
- less code is needed: since Convention plugin will scan some packages looking for Actions, you don't need to declare any action anymore. The same is applied to method name, result declaration, and so on: you will specify only things that differ from the standard behavior, while with XML you will have to write "the obvious" each time;
- the knowledge is decentralized (or distributed): the configuration is now in the place it is meant to be; if you are inside an Action, you don't need to open the
struts.xml
configuration file, find the action element (among many others) to discover how it is configured; you can simply look at the Annotations inside the class to understand immediately how it works. The same is applied to Validation (inside the class and not in theactionName-validation.xml
file;
This will help you having more granularity, a cleaner code, smaller files and almost no configuration.