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
191
votes
5 answers

Difference between / and /* in servlet mapping url pattern

The familiar code: main /* main / My…
Candy Chiu
  • 6,579
  • 9
  • 48
  • 69
189
votes
4 answers

How to define servlet filter order of execution using annotations in WAR

If we define webapp specific servlet filters in WAR's own web.xml, then the order of execution of the filters will be the same as the order in which they are defined in the web.xml. But, if we define those filters using @WebFilter annotation, what…
siva636
  • 16,109
  • 23
  • 97
  • 135
180
votes
11 answers

What does the servlet value signify

I am getting a bit confused here. In our application we are having a few servlets defined. Here is the excerpt from the web.xml for one of the servlets: AxisServlet Apache-Axis…
Vini
  • 8,299
  • 11
  • 37
  • 49
148
votes
3 answers

How to specify the default error page in web.xml?

I am using element in web.xml to specify the friendly error page when user encounters a certain error such as error with code of 404: 404
ipkiss
  • 13,311
  • 33
  • 88
  • 123
123
votes
1 answer

What is resource-ref in web.xml used for?

I'm just wondering when/why you would define a element in your web.xml file? I would have thought that it would be defined in your web/app server using JNDI and then look up the JNDI reference in your Java code? The resource-ref…
JMM
  • 3,922
  • 6
  • 39
  • 46
78
votes
8 answers

What is web.xml file and what are all things can I do with it?

The web.xml Deployment Descriptor Elements in Oracle's BEA WebLogic Server 8.1 Documentation pretty much sums up each element in a web.xml file. But I am also curious about points below: Is there any configuration parameter which should be avoided…
Ravi Gupta
  • 4,468
  • 12
  • 54
  • 85
73
votes
6 answers

Why do we use web.xml?

What is the use of web.xml and why do we use? wicket.mysticpaste org.apache.wicket.protocol.http.WicketFilter
theJava
  • 14,620
  • 45
  • 131
  • 172
70
votes
3 answers

Loading context in Spring using web.xml

Is there a way that a context can be loaded using web.xml in a Spring MVC application?
Ganesh
  • 1,654
  • 2
  • 19
  • 32
69
votes
12 answers

Session TimeOut in web.xml

I am trying to understand the real purpose of session configuration in Web.xml for session timeout. 60 Now let me tell you about my…
Vineet
  • 861
  • 2
  • 7
  • 6
65
votes
9 answers

Can I turn off the HttpSession in web.xml?

I would like to eliminate the HttpSession completely - can I do this in web.xml? I'm sure there are container specific ways to do it (which is what crowds the search results when I do a Google search). P.S. Is this a bad idea? I prefer to completely…
les2
  • 14,093
  • 16
  • 59
  • 76
63
votes
3 answers

How to exclude one url from authorization

My web.xml looks like: app /*
hudi
  • 15,555
  • 47
  • 142
  • 246
60
votes
1 answer

Sometimes I see JSF URL is *.jsf, sometimes *.xhtml and sometimes /faces/*. Why?

Been try to learn JSF, and sometimes I see the URL is *.jsf and sometimes is *.xhtml or /faces/*. Can someone fill my knowledge, please? When I create a JSF using Facelet, the file extension is .xhtml, so where does .jsf URL extension come from?
Thang Pham
  • 38,125
  • 75
  • 201
  • 285
58
votes
7 answers

Maven: Customize web.xml of web-app project

I have a web application Maven project, and I want to customize the web.xml file depending on the Profile that is running. I am using the Maven-War-plugin, which allows me to define a "resources" directory, where the files may be filtered. However,…
Markos Fragkakis
  • 7,499
  • 18
  • 65
  • 103
57
votes
8 answers

How can I map a "root" Servlet so that other scripts are still runnable?

I'm trying to build a Servlet that calls a JSP page similar to the following: public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException { …
Jeremy Logan
  • 47,151
  • 38
  • 123
  • 143
52
votes
2 answers

What is the significance of url-pattern in web.xml and how to configure servlet?

I have manually configured web.xml for my application. Now, I'm facing issues while running my application. I'm trying to access my servlet from my jsp page. But, it is throwing error as page not found. The servlets are placed under below folder…
gkumar
  • 521
  • 1
  • 4
  • 4
1
2 3
99 100