Recommended: Sing it, brah! 5 fabulous songs for developers
JW's Top 5
Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
Page 4 of 5
New portable custom UI components (widgets) with Comet ability can be delivered under frameworks such as JSF and Wicket. With annotations and pluggability in Servlet 3.0 -- features I'll discuss in the next section -- these widgets can be used off the shelf without any configuration. For application developers, this surely is great news.
In addition to asynchronous support, the Servlet 3.0 specification includes enhancements designed to make application configuration and development easier.
With Servlet 3.0, you now have three options for configuring a Java Web application: annotations, the API, and XML. Annotations,
introduced in Java 5, are widely accepted as a metadata facility at the Java source-code level. With annotations, the need
for XML configuration is drastically lowered. The new specification introduces several handy annotations. The @WebServlet, @ServletFilter, and @WebServletContextListener annotations are equivalent to their corresponding tags in the web.xml deployment descriptor file.
A general rule that applies to various Java technologies is that configurations set programmatically take precedence over values in XML, and that XML always overrides annotations. I think of XML and annotations as complementary techniques. For relatively static settings closely related to specific Java classes, methods, properties, I would use source-level annotations. I prefer to use XML for more volatile, global settings not tied to Java source code to avoid recompilation on changes, or when I don't have access to the Java source code (because classes are wrapped in a JAR file), or when I need to override the settings defined in annotations.
At the same time, the specification augments the ServletContext class with a few methods -- ServletContext.addServletMapping(...) and ServletContext.addFilter(...), for example -- that allow you to alter configurations programmatically. The availability of annotations and these new methods
as configuration options means a web.xml file is no longer required in a Java Web archive (WAR) file.
Regardless of the framework you use now for Web development, you're always required to add several technology-mandated servlets
or filters with specific settings in your Web application's web.xml file. Even worse, you must add yet more servlets, filters, and parameters if you want to incorporate technology extension
packages offering custom GUI widgets or security features (such as Spring Security). Your web.xml file keeps growing and gradually becomes a maintenance hassle.
Although annotations in Servlet 3.0 make a web.xml file optional, XML sometimes is still desirable for cases such as incremental upgrades, to override either the default attribute
values or the values set via annotations. To improve pluggability for frameworks and component libraries, Servlet 3.0 introduces
a new XML <web-fragment> tag for specifying a Web fragment (a list of components described as a partial web.xml file ) that can be included in the META-INF directory of a library or framework's JAR file. Servlet containers will pick up and merge the fragment declarations when
the JAR file is loaded and scanned as part of the entire Web application.