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:
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 name | Servlet specifications | JSP specifications | Exception class | ManagedBean(JSF) | Other class | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Servlet | Servlet (API) | Servlet filter | Servlet filter (API) | Event listener | Event listener (API) | JSP FILE | Tag handler | Tag library event listener | |||||
Classic tag handler | Simple tag handler | ||||||||||||
@HandlesTypes | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | Y |
@HttpConstraint | Y | Y | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- |
@HttpMethodConstraint | Y | Y | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- |
@MultipartConfig | Y | Y | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- |
@ServletSecurity | Y | Y | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- |
@WebFilter | -- | -- | Y | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- |
@WebInitParam | Y | -- | Y | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- |
@WebListener | -- | -- | -- | -- | Y | -- | -- | -- | -- | -- | -- | -- | -- |
@WebServlet | Y | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- |
Annotation that can be coded in EJB-JAR file is not available.
Annotation that can be coded in Servlet or JSP of library JAR is not available.
Annotation that can be coded in Enterprise Bean of JAR library, exception class, and other class is not available.