struts-config file path problem

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" ?>
  < 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 >  

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326646090&siteId=291194637