JSF 2.0 comes up with annotation. However in JSF 1.2 we defined attributes in faces-config.xml file.
In JSF 2.0 we have two options, either make use of annotation or use faces-config.xml. What is better approach? Writhing the properties in faces-config.xml is easily manageable, whereas writing annotation in each file is somewhat not easily manageable.
Annotations are generally preferable because they keep information about a class with the code of the class, so you don't have to look in another place to understand it. It also reduces duplication of information because you don't have to write out the class name to specify what class the annotation belongs to.
Then again, for some things it can be valuable to have all information of a certain kind collected in one place (e.g. URL mappings). Fortunately, annotations and XML configuration are compatible, so you can put some things into XML and use annotations for everything else.
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