2.1.7 Scope of support for the annotations included in the javax.servlet.annotation package

This subsection describes the applicable scope of the annotations of the javax.servlet.annotation package. The annotations that can be coded in each component are as follows:

Organization of this subsection
(1) WAR file (Servlet 3.0 compliant)
(2) EJB-JAR file
(3) Library JAR (Servlet/JSP)
(4) Library JAR (Enterprise Bean/ Exception class/ Other classes)

(1) WAR file (Servlet 3.0 compliant)

The following table lists the annotations that you can code in a WAR file:

Table 2-23 Annotations (javax.servlet.annotation package) that can be coded in WAR file (Servlet 3.0 compliant)

Annotation nameServlet specificationsJSP specificationsException classManagedBean(JSF)Other class
ServletServlet (API)Servlet filterServlet filter (API)Event listenerEvent listener (API)JSP FILETag handlerTag library event listener
Classic tag handlerSimple tag handler
@HandlesTypes------------------------Y
@HttpConstraintYY----------------------
@HttpMethodConstraintYY----------------------
@MultipartConfigYY----------------------
@ServletSecurityYY----------------------
@WebFilter----Y--------------------
@WebInitParamY--Y--------------------
@WebListener--------Y----------------
@WebServletY------------------------
Legend:
Y: Supported.
--: Not supported by standard specifications.

(2) EJB-JAR file

Annotation that can be coded in EJB-JAR file is not available.

(3) Library JAR (Servlet/JSP)

Annotation that can be coded in Servlet or JSP of library JAR is not available.

(4) Library JAR (Enterprise Bean/ Exception class/ Other classes)

Annotation that can be coded in Enterprise Bean of JAR library, exception class, and other class is not available.