0

why do we use this?

@WebServlet(urlPatterns = {"/process"})

9th Mar 2017, 2:57 PM
Somnath Ghosh
Somnath Ghosh - avatar
3 ответов
+ 1
@WebServlet annotation is used to declare the Java class as servlet.
11th Mar 2017, 6:04 AM
Rajeshwar Reddy
Rajeshwar Reddy - avatar
+ 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.
12th Mar 2017, 5:14 PM
Rajeshwar Reddy
Rajeshwar Reddy - avatar
0
and what is urlPatterns???
12th Mar 2017, 2:13 PM
Somnath Ghosh
Somnath Ghosh - avatar