Annotation Interface WebServlet
This annotation is used to declare the configuration of a
If the name attribute is not defined, the fully qualified name of the class is used.
At least one URL pattern MUST be declared in either the
The
The class on which this annotation is declared MUST extend
E.g.
E.g.
Servlet. If the name attribute is not defined, the fully qualified name of the class is used.
At least one URL pattern MUST be declared in either the
value or urlPattern attribute of the
annotation, but not both.The
value attribute is recommended for use when the URL pattern is the only attribute being set, otherwise
the urlPattern attribute should be used.The class on which this annotation is declared MUST extend
HttpServlet. E.g.
@WebServlet("/path")}
public class TestServlet extends HttpServlet ... {E.g.
@WebServlet(name="TestServlet", urlPatterns={"/path", "/alt"})
public class TestServlet extends HttpServlet ... {- Since:
- Servlet 3.0 (Section 8.1.1)
-
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionbooleanIndicates whether this servlet supports asynchronous operation.Provides a description of this servlet.Provides a display name for this servlet.Declares initialization parameters for this servlet.Provides the URL of a large icon for this servlet.intProvides a load-on-startup ordering hint for this servlet.Provides the name of this servlet.Provides the URL of a small icon for this servlet.String[]Declares the URL patterns for this servlet.String[]A convenience method, to allow extremely simple annotation of a class.
-
Element Details
-
name
-
value
String[] valueA convenience method, to allow extremely simple annotation of a class.- Returns:
- array of URL patterns
- See Also:
- Default:
{}
-
urlPatterns
String[] urlPatternsDeclares the URL patterns for this servlet.- Returns:
- array of URL patterns to which this Servlet applies
- Default:
{}
-
loadOnStartup
int loadOnStartupProvides a load-on-startup ordering hint for this servlet.- Returns:
- load on startup ordering hint
- Default:
-1
-
initParams
WebInitParam[] initParamsDeclares initialization parameters for this servlet.- Returns:
- array of initialization params for this Servlet
- Default:
{}
-
asyncSupported
boolean asyncSupportedIndicates whether this servlet supports asynchronous operation.- Returns:
- asynchronous operation supported by this Servlet
- Default:
false
-
smallIcon
String smallIconProvides the URL of a small icon for this servlet.- Returns:
- small icon for this Servlet, if present
- Default:
""
-
largeIcon
String largeIconProvides the URL of a large icon for this servlet.- Returns:
- large icon for this Servlet, if present
- Default:
""
-
description
String descriptionProvides a description of this servlet.- Returns:
- description of this Servlet, if present
- Default:
""
-
displayName
String displayNameProvides a display name for this servlet.- Returns:
- display name of this Servlet, if present
- Default:
""
-