Javatpoint Logo
Javatpoint Logo

Struts 2 Tutorial: Multiple Configuration File Example

For a large application, it is better to use multiple configuration file that one so that it may be easy to manage the application.

We can create many configuration files but we need to define it in the struts.xml file. The includesub-element of struts is used to define the supported configuration file.

Example to create multiple configuration files

Let's see the simple example to define multiple configuration files.

1) Define entry of multiple configuration files in struts.xml

In this struts.xml file, we have defined 2 configuration files struts-first.xml file and struts-second.xml file.

The struts-first.xml file is located inside the first directory and struts-second.xml file is located inside the second directory.


2) Create configuration files

Let's create two configuration files that defines action with results.


Other Required Resources

To run this application, we need following resources:

  1. index.jsp
  3. 2 View Components


This jsp page creates two links.


Action class

It is the simple Action class containing only execute method.

2 view components

The name of 2 view components are same i.e. welcome.jsp but both are located differently.


It is located inside the first directory under root.

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA