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
14
votes
4 answers

Tomcat Session Timeout web.xml

This is my web.xml file, it is located in WEB-INF/lib. It specifies session timeout at 1 minute, however it does not time the user out after 1 minute of activity. Web.xml:
Colin747
  • 4,955
  • 18
  • 70
  • 118
13
votes
5 answers

spring mvc how to bypass DispatcherServlet for *.html files?

web.xml fragment Spring MVC Dispatcher Servlet org.springframework.web.servlet.DispatcherServlet
Bobo
  • 8,777
  • 18
  • 66
  • 85
13
votes
3 answers

Can you read a java property in web.xml?

I would like to control the settings in web.xml and using different once for different environments. Is it possible to use a property, from a property file on classpath, in web.xml? Something like this:
per_jansson
  • 2,103
  • 4
  • 29
  • 46
13
votes
1 answer

Jersey 2.3 Setting Priority for ContainerRequestFilter

public class MyApplication extends ResourceConfig { public MyApplication() { /* // Register resources and providers using package-scanning. packages("com.keylesson.service"); // Register my custom provider - not needed…
curiousengineer
  • 2,196
  • 5
  • 40
  • 59
13
votes
4 answers

Static files in (Java) App Engine not accessible

The example documentation says that you simply need to place your files in war/ (or a subdirectory) and they should be accessible from the host (as long as they aren't JSPs or in WEB-INF). For example, if you place foo.css in war/ then you should be…
Jeremy Logan
  • 47,151
  • 38
  • 123
  • 143
12
votes
4 answers

Spring MVC no default constructor found?

I'm having problems with my Spring controllers - I'm getting no default constructor found - but they do have a constructor which I am trying to created via the applicationContext.xml - heres the relevant bit:
Rory
  • 1,805
  • 7
  • 31
  • 45
12
votes
4 answers

How to request complete query string in Spring MVC?

In Spring MVC, I can do this to get a value of items on the query string: public void sendMessage(HttpServletResponse response, @RequestParam("Session Id") String sessionId, But how to I get the complete querystring…
Rory
  • 1,805
  • 7
  • 31
  • 45
12
votes
1 answer

Configuring Grizzly with a web.xml

I can start grizzly and deploy Jersey webservices on it with the following lines. protected HttpServer create() throws Throwable { ResourceConfig rc = new PackagesResourceConfig("com.resource", "com.provider"); HttpServer server =…
yves amsellem
  • 7,106
  • 5
  • 44
  • 68
12
votes
2 answers

Call method on undeploy from a Java web-application

I am developing a Java web-application. The application connects to a Lucene index. I create a singleton instance of IndexSearcher. This instance opens some files. When I redeploy the web-application, the files opened by the earlier instance of…
Shashank Agarwal
  • 2,769
  • 1
  • 22
  • 24
12
votes
7 answers

Using JSP code in JavaScript

I want to use JSTL's fmt tag in JavaScript to localize my alert messages. My JavaScript file is a standalone file and when I include fmt tag in js, the file browser gives JavaScript errors. Is it possible to treat .js file as .jsp files using…
None
12
votes
1 answer

Element web-app must be declared error in intellij (java,springmvc,maven)

this is my web.xml file which getting element web-app must be declared error
suraha
  • 387
  • 2
  • 4
  • 16
12
votes
2 answers

Using CLIENT-CERT for Tomcat without specifying a username

I am trying to make a Tomcat web application use client certificate authentication for incoming connections. Everything works fine when using clientAuth=true in server.xml, however due to other applications running on the same server, we cannot use…
user unknown
  • 421
  • 1
  • 5
  • 14
11
votes
1 answer

what if url pattern matches multiple servlets?

s1 /abc s2 /abc
Xyzxyz Xyz
  • 415
  • 1
  • 5
  • 6
11
votes
2 answers

How do I provide basic http authentication for static tomcat webapps without changing tomcat-users.xml?

I have access to the tomcat manager and can upload war-files. One of these wars is a static web project (zipped html + media files, renamed to *.war). I want add a Web-INF/web.xml file to this war to protect the content with basic http auth. I know…
Juve
  • 10,584
  • 14
  • 63
  • 90
11
votes
1 answer

web.xml 404 redirect to servlet, how to get the original URI?

I'm redirecting 404 errors to a servlet via the following in my web.xml. 404 /notFound.do I'd like to log where the request was trying to go, but I'm not getting it…
Eric Pierce
  • 187
  • 1
  • 9