Hi Don,
Until now, I configured the datasource through the tag in the
context.xml file (in the META-INF directory of my app) and through the
web.xml with the tag like this :
context.xml :
web.xml :
jdbc/myDatabase
javax.sql.DataSource
Con
One word, eh? ServletContextListener. Use a ServletContextListener to
load your properties files and pass the name to it via servlet context
parameter. There are ways to use Struts classes to initialize and
load the data, but I wouldn't recommend it when there are solutions
that are just as effe
Thank you Don,
In fact, I don't want to have the name of my properties file to be hard
coded... So I thought about the "key initialization parameters" that allowed
me to set the name of the file and the Java class to load it.
Do you think it is a right way to do it, or maybe should I think about
If you just need to load a few properties, you shouldn't have to touch
Struts at all. Just create a file, say,
WEB-INF/classes/db.properties, then load it in your Java code via:
Properties props = new Properties();
props.load(this.getClass().getClassLoader().getResourceAsStream("/db.properties")
Hi all,
I'd like to load a file containing the parameters to connect to DB at the
application startup. In the S2 documentation I read about the "key
initialization parameters" (http://struts.apache.org/2.x/docs/webxml.html)
and so I add the 2 lines to my web.xml like this :
action2
5 matches
Mail list logo