Package jakarta.servlet.annotation
Annotation Type 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)
- 
Element Details- 
nameString name- Returns:
- name of the Servlet
 - Default:
- ""
 
- 
valueString[] valueA convenience method, to allow extremely simple annotation of a class.- Returns:
- array of URL patterns
- See Also:
 - Default:
- {}
 
- 
urlPatternsString[] urlPatterns- Returns:
- array of URL patterns to which this Filter applies
 - Default:
- {}
 
- 
loadOnStartupint loadOnStartup- Returns:
- load on startup ordering hint
 - Default:
- -1
 
- 
initParamsWebInitParam[] initParams- Returns:
- array of initialization params for this Servlet
 - Default:
- {}
 
- 
asyncSupportedboolean asyncSupported- Returns:
- asynchronous operation supported by this Servlet
 - Default:
- false
 
- 
smallIconString smallIcon- Returns:
- small icon for this Servlet, if present
 - Default:
- ""
 
- 
largeIconString largeIcon- Returns:
- large icon for this Servlet, if present
 - Default:
- ""
 
- 
descriptionString description- Returns:
- description of this Servlet, if present
 - Default:
- ""
 
- 
displayNameString displayName- Returns:
- display name of this Servlet, if present
 - Default:
- ""
 
 
-