Struts 2 framework Configuration

The Struts 2 framework Configuration

Ther are the folloeing important files that s need to be create for the proper configuration of strtus 2 application  and the  Important configuration files are as follows : web.xml, struts.xml, struts-config.xmland

The web.xml file:

The web.xml configuration file is a J2EE configuration file that determines how elements of the HTTP request are processed by the servlet container. It is not strictly a Struts2 configuration file, but it is a file that needs to be configured for Struts2 to work. 

xml version="1.0" encoding="UTF-8"?>

<web-app xmlns:xsi="" xmlns="" xmlns:web="" xsi:schemaLocation="" id="WebApp_ID" version="3.0">



















 The struts.xml file:

Here, we are going to learn all about struts.xml file. First of all let us see the simple example of struts.xml file. Let`s have a look on one simple struts.xml file we created.

The struts.xml file contains the configuration information that you will be modifying as actions are developed or according to the development needs. This file can be used to override default settings for an application, for example struts.devMode = false and other settings which are defined in property file. This file can be created under the folder WEB-INF/classes. 

xml version="1.0" encoding="UTF-8" ?>


"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"



<constant name="struts.enable.DynamicMethodInvocation" value="false" />

<constant name="struts.devMode" value="false" />

<constant name="struts.custom.i18n.resources" value="myapp" />

<package name="default" extends="struts-default" namespace="/">

<action name="login" class="r4r.LoginAction">

<result name="success">Welcome.jspresult>

<result name="error">Login.jspresult>