How to configure web.xml to map a servlet to more than one url pattern in Java?

+1 vote
41 views
asked Jun 6 in JAVA by codeg (2,600 points)
Hi all

   Can you plese provide the WEB.xml How to configure web.xml to map a servlet to more than one url pattern in Java?

1 Answer

0 votes
answered Jun 6 by anonymous

Sample web.xml

  

<servlet>

<servlet-name>countrylist</servlet-name>

<servlet-class>

org.springframework.web.servlet.DispatcherServlet

</servlet-class>

<load-on-startup>1</load-on-startup>

</servlet>

<servlet-mapping>

<servlet-name>countrylist</servlet-name>

<url-pattern>/</url-pattern>

<url-pattern>/countrycode</url-pattern>

</servlet-mapping>

...