Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Java Servlets
Expertise: Beginner
Oct 10, 2000

Servlet Resources

Question:
Where is the best place to store .property files and .xml files for servlets/jsp? Right now I am using "user.home", but there is a problem when you have multiple web application because you may store only one set of files.

Answer:
You have several choices. You could use resource bundles, store the files in the classpath and use Class.getResource() to retrieve it, use servlet init parameters to tell the servlet the location of the resources, or define system properties.

Resource bundles are the most general mechanism and allow for internationalization. Servlet init parameters allow the greatest flexibility in that you can pass any arbitrary location to the servlet. Storing files in the classpath makes for rather awkward applicaiton deployments as does defining system properties. Ultimately, the exact nature of your application will dictate the most appropriate way to go.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap