I am new to struts java application & i want to store database connections & global variables.
What is best option to store values (Web.xml or struts-config.xml).
and How to access the variables defined in that xml files.
Is there any other way to store & access database connections.
There should be way so that i can go & edit the files like variables and databases connections easily.
I am new to struts java application & i want to store database connections
Share
Best way to store your database connection is
For reading property file you can make use of
java.util.ResourceBundleand any XML parser likeX-Streamfor XML parsing.Though if you want can make use of your web.xml to store database connection configuration parameters.
For global variable you can use simple a Constant class where you can define those variable and can use them throughout your application.