Which is the easier and organized way to use Struts2 ? With Annotations or with XML files ?
If with annotations, then with which kind of annotations? With struts-convention-plugin you can even avoid completely writing conventions i.e@results
or @action
.
What benefits will annotations give over not writing them ?
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;
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 the actionName-validation.xml
file;This will help you having more granularity, a cleaner code, smaller files and almost no configuration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With