Struts 2 – Development mode example

In Struts 2 development, this should be the first configurable value to learn. To enable the Struts 2 development mode, you can significantly increase your Struts 2 development speed by giving auto configuration and properties files reload and extra logging and debugging feature.

The auto reload feature is really a convenient feature. Each time i made changed in properties or XML configuration file, the application is no longer need to restart to take effect.
By default, the Struts 2 development mode is disabled.

Enable the Strut2 development mode

Set the “struts.devMode” value to true, either in Struts properties file or XML configuration file.

struts.properties

struts.devMode = true

struts.xml


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

Disable the Strut2 development mode

Set the “struts.devMode” to false, either in Struts properties file or XML configuration file.

struts.properties

struts.devMode = false

struts.xml


<struts>
 	<constant name="struts.devMode" value="false" />	
</struts>
The development mode is only suitable in development or debugging environment. In production environment, you HAVE TO disabled it. It will caused significant impact on performance, because the entire application configuration, properties files will be reloaded on every request, many extra logging and debug information will be provide also.
Before commit Struts configuration file, just make sure the development mode is turn off. I saw many accidentally commit cases – commit with development mode enable, and someone just grab the source code for QA environment. To be Frankly, QA seldom will do the performance test, they just make sure the functionality are there, and end with a development mode enabled application deployed to the production. Guess what? you will receive many screaming phone calls from clients very soon…

Reference

  1. Struts 2 development mode documentation

About the Author

author image
mkyong
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter, or befriend him on Facebook or Google Plus. If you like my tutorials, consider make a donation to these charities.

Comments

Leave a Reply

avatar
newest oldest most voted
vikas
Guest
vikas

But sir what is main need of this devMode true/false?

There is no effect in my application while changing it either T/F.

Chandu
Guest
Chandu
Hi Yong, We are also facing same problem as Hariprasad said in previous post. We are using jar like struts2-core-2.3.1.jar , struts2-dojo-plugin-2.3.1.jar ..etc We are using struts xml type validations. In jsp(myDataList.jsp) our code as below: ====================================== .. .. struts.xml configuration: ========================= .. .. .dataList .dataList Error we are getting as below: ============================== Caused by: javax.servlet.ServletException: javax.servlet.jsp.JspException: IO Error executing tag: JSPException including path ‘/jsp/vesselPerformance/noonReportList.jsp’. at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858) [:6.1.0.Final] … 73 more Caused by: org.apache.tiles.util.TilesIOException: JSPException including path ‘/jsp/vesselPerformance/noonReportList.jsp’. at org.apache.tiles.servlet.context.ServletTilesRequestContext.wrapServletException(ServletTilesRequestContext.java:298) [:2.0.6] … 86 more Caused by: tag ‘select’, field ‘list’, name ‘vesselPerformanceRequestDTO.operatorId’: The requested list key ‘operators’ could not be… Read more »
Hariprasad
Guest
Hariprasad

I have put in strut.xml file but my application vaildation is not working and when i see vew source there is no validation for the fields but when put struts.devMode=true javascript validation is displaying for the fields and when i click on save or submit button displaying error in console
tag ‘select’, field ‘list’, name ‘userListDTO.appUserAccount.roleName’: The requested list key ‘roles’ could not be resolved as a collection/array/map/enumeration/iterator type. Example: people or people.{name} – [unknown location]

please suggest us .

-hariprasad

SONIYA
Guest
SONIYA

I LIKE THIS SITE A LOT .SUCH A WONDERFUL EXPLANATION ON EVERY TOPIC

Active
Guest
Active

This is the best website I have visited. Very good explanation of every article. The best part is they have included even very small topics , which you will rarely find on any site. It makes the development very easy.

Ash
Guest
Ash

Mr Yong,
Toooo Gooood Article
The website is Simply Best!!! Absolutely loved it