In a java web application, there is a file called web.xml and it has a versioning.
What exactly is this? What is it used for?
Here is the SO wiki for web.xml. But it does not really explain me much.
It allows you to define, declare and configure the Servlet API based implementations in your web application, such as servlets, filters and listeners.
Sample web.xml versioning:
<web-app 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_3_0.xsd" version="3.0">
Can someone explain this with simple examples perhaps?
A web application (or web app) is application software that runs in a web browser, unlike software programs that run locally and natively on the operating system (OS) of the device. Web applications are delivered on the World Wide Web to users with an active network connection.
A Web application (Web app) is an application program that is stored on a remote server and delivered over the Internet through a browser interface. Web services are Web apps by definition and many, although not all, websites contain Web apps.
In computer system, a web application is a client-side and server-side software application in which the client runs or request in a web browser. Common web applications include email, online retail sales, online auctions, wikis, instant messaging services and more.
Web.xml
is a central place where you define the configuration of your Web application. For instance you can specify there:
I would also suggest researching Servlet 3.0 specification, where many of these parameters can be set through annotations.
Versioning refers to XML schema version that syntax of your web.xml
file must obey. More important, it also indicates the version of Servlet specification that your application implements. An example how Servlet 3.0-compliant web.xml
should begin:
<web-app version="3.0" 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_3_0.xsd">
Most IDEs will automatically generate that part of web.xml
. If you are going to change it manually for some reason, be careful to match the versions of web-app and xsd.
For concrete examples of web.xml
, see:
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