Web XML or web.xml File Syntax
What is the syntax of a Web XML File for JSP?
Explanation
Web XML file is added in for web application developed using Java platform as it defines information about servlets, JSP pages, is also enumerates enterprise beans within a web application.This is the file read by the web service provider to know how to run a web service.
The "web.xml" file is located in the "WEB-INF" folder under web application folder.
Syntax:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>MY WEBSITE</display-name>
.
<!--Comments-->
.
XML tags
.
.
</web-app>
The XML tags contained in this file are for mapping servlets, jsp pages, error pages, specifying session time etc. The tags "<!", ">" is used to display the comments in a web.xml file.