This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Tomcat and the fly likes How to set a global string variable! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "How to set a global string variable!" Watch "How to set a global string variable!" New topic
Author

How to set a global string variable!

Richard Elsberry
Ranch Hand

Joined: Mar 14, 2001
Posts: 40
I am trying to figure out how to set a string variable that will represent the location on the local file system. This location will be different between development and production so I would like to be able to set this for each location. I've been successful at using jndi to set the datasource for each location so I tried something like this:

<Resource name="jdbc/localPath" auth="Container" type="java.lang.String" value="C:\\work\\swstir\\images\\" />

but I get a "Cannot create resource instance" error message. It seems like either the <TOMCAT-HOME>/conf/web.xml or server.xml is where this should be set but I can't figure out how it's done. Any thoughts?

Thanks,
Richard
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How to set a global string variable!