0
why do we use this?
@WebServlet(urlPatterns = {"/process"})
3 Respuestas
+ 1
@WebServlet annotation is used to declare the Java class as servlet.
+ 1
In XML file we write like this to link the servlet class and url
<servlet>
<servlet-class>ExampleServlet</servlet-class>
<servlet-name>abc</servlet-name>
</servlet>
<servlet-mapping>
<servlet-name>abc</servlet-name>
<url-pattern>/url</url-pattern>
</servlet-mapping>
In servlet mapping we use url-pattern tag.
But to replace this in annotations, we can use an attribute called urlPattern in @webServlet annotation.
0
and what is urlPatterns???