an introduction
The struts-config file path does not have to be placed in /WEB-INF, you can put it yourself.
Two modification methods
For example:
struts-config placement path is as shown in the screenshot below
Configuration method
<?
xml
version
=
"1.0"
encoding
=
"UTF-8"
?>
<
web-app
xmlns
=
"
http://java.sun.com/xml/ns/javaee"
;
xmlns:xsi
=
"
http://www.w3.org/2001/XMLSchema-instance"
;
version
=
"2.5"
xsi:schemaLocation
=
"
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
;
>
<
display-name
/>
<
servlet
>
<
servlet-name
>
action
</
servlet-name
>
<
servlet-class
>
org.apache.struts.action.ActionServlet
</
servlet-class
>
<!-- configure struts-config.xml -->
<
init-param
>
<
param-name
>
config
</
param-name
>
<
param-value
>
/WEB-INF/
config
/struts-config.xml
</
param-value
>
</
init-param
>
<
init-param
>
<
param-name
>
debug
</
param-name
>
<
param-value
>
3
</
param-value
>
</
init-param
>
<
init-param
>
<
param-name
>
detail
</
param-name
>
<
param-value
>
3
</
param-value
>
</
init-param
>
<
load-on-startup
>
0
</
load-on-startup
>
</
servlet
>
<
filter
>
<
filter-name
>
Myfilter1
</
filter-name
>
<
filter-class
>
com.cakin.filters.Myfilter1
</
filter-class
>
</
filter
>
<
filter-mapping
>
<
filter-name
>
Myfilter1
</
filter-name
>
<
url-pattern
>
/*
</
url-pattern
>
</
filter-mapping
>
<
servlet-mapping
>
<
servlet-name
>
action
</
servlet-name
>
<
url-pattern
>
*.do
</
url-pattern
>
</
servlet-mapping
>
<
welcome-file-list
>
<
welcome-file
>
index.jsp
</
welcome-file
>
</
welcome-file-list
>
</
web-app
>
Three test results
Four how to configure multiple struts-config files
It can be configured in the web.xml file
<
init-param
>
<
param-name
>
config
</
param-name
>
<
param-value
>
/WEB-INF/
config
/struts-config.xml,/WEB-INF/
config
/struts-
config
-2.
xml
</
param-value
>
</
init-param
>
<
init-param
>