struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Miguel Almeida <mig...@almeida.at>
Subject Can you define variables as the value in struts.properties?
Date Mon, 18 Jun 2012 16:14:17 GMT
Lets say I have the following files in my app:

- app-DEV.properties
- app-PROD.properties
- app-TEST.properties

I use Spring's <jee:jndi-lookup> and PropertyPlaceholderconfigurer (see
[1]) to achieve a multi-environment setup. All files are in the
classpath, but because on each environment I set the capitalized part
differently (eg: IDE has an environment variable defined to DEV, while
the production container has it set to PROD) only one file is loaded,
setting up Spring configuration correctly.

Enter Struts: I wanted to take advantage of these existing properties
further to the UI level.
Eg: 
1) have a jsp with <s:text name="app.client"/>
2) have in your struts.properties the entry
struts.custom.i18n.resources=a,...,environments/app-DEV
3) if you have app.client on the file app-DEV.properties, set to FOO,
you'll see it on the web page

Question: Having multiple environments files, what I really need is
struts.custom.i18n.resources=environments/app-${envName}. Can one have
this, so only the file that makes sense for that environment is loaded?

[1] https://gist.github.com/2948672

Cheers,

Miguel Almeida






Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message