You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Peter J Ford (JIRA)" <ji...@apache.org> on 2018/03/22 17:34:00 UTC

[jira] [Updated] (WW-4928) Setting struts.devMode from system property not working as described

     [ https://issues.apache.org/jira/browse/WW-4928?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Peter J Ford updated WW-4928:
-----------------------------
    Description: 
According to [http://struts.apache.org/core-developers/constant-configuration.html] the struts.devMode setting can be read from environment strings or system properties. This works correctly when setting from an environment string - for example:

{{<constant name="struts.devMode" value="${env.STRUTS_DEV_MODE:false}"/>}}

However it does not work for system properties, such as setting "-DstrutsDevMode=true" as a system property and this in struts.xml:

{{<constant name="struts.devMode" value="${strutsDevMode:false}"/>}}

Having dug through the source I found that this is to do with the way the value substitutor is configured, and that using ":-" instead of ":" as the separator string when using system properties will work:

{{<constant name="struts.devMode" value="${strutsDevMode:-false}"/>}}

 

  was:
According to [http://struts.apache.org/core-developers/constant-configuration.html] the struts.devMode setting can be read from environment strings or system properties. This works correctly when setting from an environment string - for example:

{{<constant name="struts.devMode" value="${env.STRUTS_DEV_MODE:false}"/>}}

However it does not work for system properties, such as setting "-DstrutsDevMode=true" as a system property and this in struts.xml:

{{<constant name="struts.devMode" value="${strutsDevMode:false}"/>}}

Having dug through the source I found that this is to do with the way the value substitutor is configured, and that using ":-" instead of ":" as the separator string when using system properties will work:

{{<constant name="struts.devMode" value="$\{strutsDevMode*:-*false}"/>}}

 


> Setting struts.devMode from system property not working as described
> --------------------------------------------------------------------
>
>                 Key: WW-4928
>                 URL: https://issues.apache.org/jira/browse/WW-4928
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.5.14.1
>         Environment: **Windows, Linux, Solaris
>            Reporter: Peter J Ford
>            Priority: Minor
>              Labels: documentation, easyfix
>
> According to [http://struts.apache.org/core-developers/constant-configuration.html] the struts.devMode setting can be read from environment strings or system properties. This works correctly when setting from an environment string - for example:
> {{<constant name="struts.devMode" value="${env.STRUTS_DEV_MODE:false}"/>}}
> However it does not work for system properties, such as setting "-DstrutsDevMode=true" as a system property and this in struts.xml:
> {{<constant name="struts.devMode" value="${strutsDevMode:false}"/>}}
> Having dug through the source I found that this is to do with the way the value substitutor is configured, and that using ":-" instead of ":" as the separator string when using system properties will work:
> {{<constant name="struts.devMode" value="${strutsDevMode:-false}"/>}}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)