Okay, SOLVED... Condor thank you for the help. I found a slightly different way to do it.
A file resides on the server named "myfile.properties" in a private folder (not in the web server) and contains the following:
Code:
devBaseServiceUri=http://adiffdevserver/rest
testBaseServiceUri=http://adifftestserver/rest
prodBaseServiceUri=http://adiffprodserver/rest
I created a new javascript file named "MYAPP.js"
with contents
Code:
MYAPP = {
}
/**
* Constants for MYAPP
*/
MYAPP.Constants = {
devBaseServiceUri :'http://mydevserver/rest',
testBaseServiceUri : 'http://mytestserver/rest',
prodBaseServiceUri : 'http://myproductionserver/rest'
}
Then inside the index.jsp it will load my java properties file, and set the values in the environment.
A final script will read environment values into my JavaScript object variables.
Code:
<script type="text/javascript" src="js/MYAPP.js"></script>
<%@page import="java.io.FileInputStream" %>
<%@page import="java.util.Properties" %>
<%
Properties properties = new Properties();
properties.load(new FileInputStream("/privatefolder/myfile.properties"));
System.setProperty("mydevservername", properties.getProperty("devBaseServiceUri") );
System.setProperty("mytestservername", properties.getProperty("testBaseServiceUri") );
System.setProperty("myprodservername", properties.getProperty("prodBaseServiceUri") );
%>
<script type="text/javascript">
MYAPP.Constants.devBaseServiceUri = "<%= System.getProperty("mydevservername")%>";
MYAPP.Constants.testBaseServiceUri = "<%= System.getProperty("mytestservername")%>";
MYAPP.Constants.prodBaseServiceUri = "<%= System.getProperty("myprodservername")%>";
</script>
Then inside the application anywhere, you can call MYAPP.Constants.devBaseServiceUri for the value read from the properties file.
Anyhow,... thank you so much. You got me on the right track.