Home » servlet » Servlet url and class mapping using web.xml

Servlet url and class mapping using web.xml

We can map url pattern with servlet class at web.xml.

Following example will illustrate this.

Project directory structure is as below:

2_explorer

index.jsp

web.xml

Welcome1.java

In web.xml url pattern(welcome1) will match to a logical name(welcome) that logical name is matched with servlet fully qualified class name(ebhor.servlet.Welcome1).

Result:
2_first

2_second

Managed by MochaHost - Fast & Easy WordPress Hosting