Important Tag in web.xml

Web.xml file is a configuration file in Java web application, it is used to define application wide and servlet/jsp wide settings.

It is a file referred by container on the server to identify Java resources available when requested by client.

Following is the list routine tags available in web.xml file.

  • <web-app>
  • <servlet>
  • <servlet-mapping>
  • <welcome-file-list>

<web-app> : It is the root tag of all the other tags in web.xml file

<servlet> : It is a sub tag of <web-app> tag, use to define servlets name and class, it has two more sub tags which are <servlet-name> and <servlet-class>

It is also used to declare parameter for the respective servlets, using <init-param> followed by two more sub tags, <param-nam> and <param-value>


It is use to describes a pattern used to resolve URLs. This tag is to be written inside <web-app> tag and outside of any <servlet> tag.

It is uses two more sub tags such as <servlet-name> and <url-pattern>


The optional <welcome-file-list> element contains an ordered list of welcome-file elements.

– Ravi Oza


Leave a Comment

%d bloggers like this: