Questions tagged [web.xml]

The web.xml is the web deployment descriptor file of Java Servlet based web applications. It allows you to define, declare and configure the Servlet API based implementations in your web application, such as servlets, filters and listeners.

A deployment descriptor (DD) refers to a configuration file for an artifact that is deployed to some container/engine.

In the Java Platform, Enterprise Edition, a deployment descriptor describes how a component, module or application (such as a web application or enterprise application) should be deployed. It directs a deployment tool to deploy a module or application with specific container options, security settings and describes specific configuration requirements. XML is used for the syntax of these deployment descriptor files.

For web applications, the deployment descriptor must be called web.xml and must reside in the WEB-INF directory in the web application root.

Further Reading:

2074 questions
39
votes
2 answers

glassfish-web.xml vs sun-web.xml vs web.xml

Could someone explain the main differences (or provide a link to) between glassfish-web.xml, sun-web.xml and web.xml? Can I use just glassfish-web.xml in my webapp and skip the others?
sasha_trn
  • 1,935
  • 2
  • 23
  • 30
39
votes
7 answers

Referencing Environment Variables in web.xml

I'm pre-packaging a JSP web-app that relies on some file path settings found within web.xml. These settings are unknown at packaging time, because they reference a path the customer will set when deploying the entire application (of which the…
Udi Bar-On
  • 791
  • 1
  • 7
  • 20
37
votes
6 answers

cvc-id.3 error in web.xml

I'm getting this error message while editing web.xml file in eclipse for SpringMVC web-app: cvc-id.3: A field of identity constraint 'web-app-servlet-name-uniqueness' matched element 'web-app', but this element does not have a simple…
Arsenicum
  • 371
  • 1
  • 3
  • 3
36
votes
6 answers

Can we use regular expressions in web.xml URL patterns?

I am writing a filter to do a specific task but I am unable to set a specific url pattern to my filter. My filter mapping is as follows: myFilter test.MyFilter
Satya
  • 8,146
  • 9
  • 38
  • 43
36
votes
1 answer

Overview of all JSF-related web.xml context parameter names and values

There are several JavaServer Faces in web.xml: facelets.REFRESH_PERIOD, facelets.DEVELOPMENT, facelets.SKIP_COMMENTS etc. Where I can find a complete list of all those params?
Cherry
  • 31,309
  • 66
  • 224
  • 364
35
votes
5 answers

Java Servlets - Storing a list of values in web.xml (multiple param-value's for single param-name)

I'm creating a servlet that needs to load configuration information. Part of the configuration information I need is a list of Strings (specifically, a list of hostnames and/or URLs). I was hoping to store this information in my servlet's web.xml…
greenlaw
  • 867
  • 2
  • 9
  • 17
33
votes
4 answers

How to add filters to servlet without modifying web.xml

I'd like the ability to modify/configure filters in a different way than web.xml. Here is a static configuration of 2 filters. I'd like the ability to have one filter statically configured and allow that filter to load additional filters. I just…
TJR
  • 3,617
  • 8
  • 38
  • 41
33
votes
7 answers

What does this web.xml error mean?

jacekn
  • 1,521
  • 5
  • 29
  • 50
31
votes
3 answers

What exactly is the web-app version? What does it affect?

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…
Koray Tugay
  • 22,894
  • 45
  • 188
  • 319
30
votes
2 answers

No WebApplicationContext found: no ContextLoaderListener registered?

I'm trying to create a simple Spring 3 application and have the following files. Please tell me the reason for this error Below is my web.xml
Batman
  • 908
  • 4
  • 15
  • 32
30
votes
3 answers

How to register multiple servlets in web.xml in one Spring application

I want to define two servlets in my Spring web.xml - one for the application html/jsp pages, and one for a web service that will be called by an external application. Here is the web.xml: myservlet
David Buckley
  • 981
  • 7
  • 17
  • 30
29
votes
2 answers

Is security-constraint configuration for Tomcat mandatory?

In order to do an SSL Configuration testing under Tomcat, is this all mandatory? This below line is taken from a website: In order to do this for our test, take any application which has already been deployed successfully in Tomcat and first access…
Pawan
  • 31,545
  • 102
  • 256
  • 434
29
votes
3 answers

purpose of webAppRootKey?

Can somebody explain this entry in web.xml ? When it has to be used and why ? webAppRootKey webapp.root Is this something related to Spring or general one?
Maniganda Prakash
  • 4,702
  • 8
  • 34
  • 42
28
votes
2 answers

What is conf/web.xml used for in Tomcat as oppsed to the one in WEB-INF?

My Tomcat deployment has a web.xml file under the conf folder. What is conf/web.xml used for in Tomcat as opposed to the one in WEB-INF? Do I need it?
sproketboy
  • 8,967
  • 18
  • 65
  • 95
28
votes
2 answers

Servlet mapping: url-pattern for URLs with trailing slash

I have a problem related to the servlet mapping. I have the following in web.xml: HelloWorldServlet test.HelloWorldServlet
Gabriel Llamas
  • 18,244
  • 26
  • 87
  • 112