Editing web.xml in a Struts Application

By: Gokul Verma  

The web.xml file is where servlets and other stuff are defined to the servlet container. We'll remove some unnecessary things from the web.xml file so it looks like this:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"


  <!-- Standard Action Servlet Configuration (with debugging) -->

  <!-- Standard Action Servlet Mapping -->

  <!-- Struts Tag Library Descriptors -->




The web.xml file -

The file contains three sections:

  1. the definition of the Struts servlet named "ActionServlet"
  2. the URL mapping for the calls to this servlet
  3. the definitions of the Struts tag libraries

You'll see that the servlet will be called if our browser requests a file called <some-name>.do. So when we submit the form in our one-page application we'll decide to use the action-name "submit.do". How the Struts servlet knows what to do with this request we'll discover next.

Archived Comments

1. need to be place taglig in the <jsp-config> tag without this will be a error
View Tutorial          By: Shaik Basha at 2013-01-30 03:11:41

2. what is the usage of 'detail' and 'debug' init parameters in web.xml.
View Tutorial          By: uday at 2011-07-21 04:53:02

3. good
View Tutorial          By: rajesh sharma at 2011-07-18 05:20:56

4. where should i define some property so as my site calls an action when loading, and not a view direc
View Tutorial          By: juan villegas at 2010-06-12 01:24:43

5. yes simple good it wroking goog
View Tutorial          By: durga prasad pavirala at 2009-02-11 03:43:04

Most Viewed Articles (in Struts )

Latest Articles (in Struts)

Comment on this tutorial