Given: a Java EE 5 web app that has a web.xml that has a snippet like
c
You can find all javax.servlet annotations in the javax.servlet.annotation package summary:
- @HandlesTypes This annotation is used to declare the class types that a
ServletContainerInitializercan handle.- @HttpConstraint This annotation is used within the
ServletSecurityannotation to represent the security constraints to be applied to all HTTP protocol methods for which a correspondingHttpMethodConstraintelement does NOT occur within theServletSecurityannotation.- @HttpMethodConstraint This annotation is used within the
ServletSecurityannotation to represent security constraints on specific HTTP protocol messages.- @MultipartConfig Annotation that may be specified on a
Servletclass, indicating that instances of theServletexpect requests that conform to the multipart/form-data MIME type.- @ServletSecurity This annotation is used on a
Servletimplementation class to specify security constraints to be enforced by a Servlet container on HTTP protocol messages.- @WebFilter Annotation used to declare a servlet
Filter.- @WebInitParam This annotation is used on a
ServletorFilterimplementation class to specify an initialization parameter.- @WebListener This annotation is used to declare a WebListener.
- @WebServlet Annotation used to declare a servlet.
You see, there's nothing like a @WebContextParam. Which makes also less or more sense; on what kind of class would/could you set it?
Some Servlet based frameworks which rely on context parameters, such as JSF, also allows for setting some of them by JNDI. You might want to look into that instead. Or if it concerns homegrown code, then I'd look if @WebInitParam isn't a more feasible option for you.