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
0
votes
0 answers

web.xml configuration for jarx services in rest services being present in multiple jars (No Maven, spring and gradle)

I am using jars to be present in one project(say 1)( with all the configuration for server) in multiple projects(say 2,3) and to import those projects(2,3) I am importing jars 2,3 to 1. In both the projects 1, 2. I have written rest services in…
0
votes
0 answers

Activate/Deactivate Java Filter from web.xml

I am currently working with a filter that I added in web.xml (J2EE App) This filter need to be activated/deactivated from a value stored in database. How to make sure that the database connection is not opened every single request witch will exhaust…
0
votes
1 answer

Tomcat´s ExpiresFilter not working on index page

I added the following code to the web.xml of my Tomcat (version 9) server: CachingFilter org.apache.catalina.filters.ExpiresFilter
Franz Deschler
  • 2,456
  • 5
  • 25
  • 39
0
votes
1 answer

How do you add Java Based Spring config to an existing web.xml?

I have an existing web.xml and I am trying to add springs to a project. I would like to use java based spring config: like the following. AnnotationConfigWebApplicationContext appContext = new AnnotationConfigWebApplicationContext(); …
GC_
  • 35
  • 7
0
votes
1 answer

I can't run my spring boot app because web.xml file is showing an error and I don't know why

My web.xml file is showing an error and I don't know why. When I go to the file it showing red x on line two on the word "
0
votes
1 answer

How can I stop Eclipse complaining about invalid syntax in web.xml?

I am using Tomcat 9. I define a global error page in my web.xml. (As per BalusC's answer in How can I use the same error page for multiple error codes in Tomcat?) /error/exception.jsp It works…
gordon613
  • 2,770
  • 12
  • 52
  • 81
0
votes
0 answers

How to specify a Relative file path in web.xml file for my .ini file

Below is the web.xml path I added for WebApp.ini I am receiving file not found Exception but if I give the exact path i.e WAS container then war then its working.
apifeez
  • 121
  • 1
  • 6
0
votes
1 answer

I cannot see web.xml contents where I can code

My eclipse IDE shows a web.xml file which just has specifications kind of list. I am learning from a udemy course and there the instructor is able to type into this file but I am not able to. Anybody please help! Attached are the screenshots My…
0
votes
0 answers

web.xml showing error after creation , error in javaee.xml

I get the below error in the Line No 2, for the . What's wrong with the web.xml file below? There is no custom code in the project, just after creation of the dynamic Web Project:
Nandita
  • 1
  • 1
0
votes
0 answers

The content of element type "servlet" must match error

I just create a new Servlet and I have an error of this exact type: The content of element type "servlet" is incomplete, it must match…
markos
  • 1
0
votes
0 answers

Controller is not available even if mapped in web.xml

I am trying to revive an old project, I already converted it to Dynamic web module and made the jsp files working, however, the controllers cannot be seen even though I already mapped it in web.xml. It says: The requested resource…
0
votes
1 answer

How to move web.xml with init-params to Java config?

I am using Spring boot 2.6.3 and I have the following web.xml in my project. What would be the ideal way to move this to Java config?
Saif
  • 2,530
  • 3
  • 27
  • 45
0
votes
0 answers

Tomcat 8.x | Global Error Page does not work

Trying to set up a global error page for all errors and all apps in /webapps. ../conf/web.xml ... /error.html ... ../webapps/ROOT/ -rw-rw-r-- 1 mee mee 5 Feb 2 14:11…
ng-User
  • 243
  • 1
  • 6
  • 18
0
votes
1 answer

When I double click on servlet, web.xml opens in Eclipse?

I am trying to modify some old JSP project in Eclipse. I am running at some (seems trivial) problems. In Eclipse Project Explorer, there is "Deployment Descriptor: MyApp" element. Inside, there are other sub-elements: Servlets, Servlet Mappings,…
bobetko
  • 5,019
  • 14
  • 58
  • 85
0
votes
1 answer

Java servlet web.xml file cannot resolve the class in the tag in IntelliJ

I am writing a simple web service and have put my web.xml file in the WEB-INF folder. For some reason everything in the servlet-class tag is coming up as "cannot resolve class MyServlet". The class MyServlet is in the src folder under root…
user3390527