<servlet-mapping>
<servlet-name> s1</servlet-name>
<url-pattern> /abc </url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name> s2</servlet-name>
<url-pattern> /abc </url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name> s3</servlet-name>
<url-pattern> /* </url-pattern>
</servlet-mapping>
Which servlet will be called if a request /abc comes?and why?
If the web. xml file contains two identical mappings to different servlets, the container makes no guarantees about which servlet the container calls for a given request. However, two servlets may use overlapping url-pattern elements.
You can declare multiple servlets using the same class with different initialization parameters.
Check this. In short:
/abc
is more specific than /*
)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With