How can you set devMode to dynamically load struts.xml file in Struts 2?

The constant element has a name attribute and a value attribute. The struts.devMode setting determines whether or not the Struts application is in development mode. By default, the value is false, meaning the application is not in development mode.

The following constant element sets struts.devMode to true.

<struts>
struts.devMode" value="true"/>

...
struts>


Once you set this attribute to true Struts will check the config file for every request. This will save lot of development time as you need not restart server for struts.xml changes.

Second way of setting this attribute is struts.properties file which can overrides the value of default.properties file as below.
struts.devMode = true

Third way to do it is as a init-param to filter tag in deployment descriptor (web.xml) file as shown below


struts

org.apache.struts2.dispatcher.FilterDispatcher


struts.devMode
true




 



struts 2 development mode settings, struts 2 dev mode, loading struts.xml dynamically, dynamic configuration file loading struts 2, developer mode configuration setting