2.8.9 @WebServlet

Organization of this subsection
(1) Description
(2) Attribute

(1) Description

This annotation specifies Servlet.

(2) Attribute

The following table lists the @WebServlet attributes:

Attribute NameFunctionality
descriptionThis attribute specifies the Servlet description.
displayNameThis attribute specifies the display name.
initParamsThis attribute specifies the initial parameters for Servlet.
largeIconThis attribute specifies the large icons used on GUI tool.
loadOnStartupThis attribute specifies the start order of Servlet.
nameThis attribute specifies the Servlet name.
smallIconThis attribute specifies the small icons used on the GUI tool.
urlPatternsThis attribute specifies the URL patterns to be mapped.
valueThis attribute specifies the URL patterns to be mapped. Ignored if specified concurrently with urlPatterns.

Details of each attribute are as follows:

(a) description attributes
Type
String
Description
This attribute specifies the Servlet description.
Default value
""
(b) displayName attributes
Type
String
Description
This attribute specifies the display name.
Default value
""
(c) initParams attributes
Type
WebInitParam[]
Description
This attribute specifies the initial parameters for Servlet.
Default value
{}
(d) largeIcon attributes
Type
String
Description
This attribute specifies the large icons used on the GUI tool.
Default value
""
(e) loadOnStartup attributes
Type
int
Description
This attribute specifies the start order of Servlet.
Default value
-1
(f) name attributes
Type
String
Description
This attribute specifies the Servlet name.
Default value
""
(g) smallIcon attributes
Type
String
Description
This attribute specifies the small icons used on the GUI tool.
Default value
""
(h) urlPatterns attributes
Type
String[]
Description
This attribute specifies the URL patterns to be mapped.
Default value
{}
(i) value attributes
Type
String[]
Description
This attribute specifies the URL patterns to be mapped. Ignored if specified concurrently with urlPatterns.
Default value
{}