Programming Tutorials

Editing web.xml in a Struts Application

By: Gokul Verma in Struts Tutorials on 2007-04-04  

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 "". How the Struts servlet knows what to do with this request we'll discover next.

Add Comment

* Required information


No comments yet. Be the first!

Most Viewed Articles (in Struts )

Latest Articles (in Struts)