• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Servlet config in servlets

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I want to read the properties file which is in /WEB-INF/classes of my application. I am using tomcat.I have written a servlet. I want to read the properties file from the servlet. How can I do that. If I want to use the init(ServletConfig config) method for reading the properties file using servlet context how I can do it. Do I have to configure the servlet config in web.xml file.
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can use this method to get your properties file from the WAR. However a properties file is not meant to be deployed along with a WAR file. A properties file should be placed outside the project location where it can be accessed by the application. Ideally you should be able to simply edit the file, and restart the application so that it can absorb the new changes. It is also possible to code in such a way that editing the file alone is sufficient. The advantage being that you dont have to build the WAR file again.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Deepak Bala wrote:However a properties file is not meant to be deployed along with a WAR file.


That's highly dependent on the property file in question--there are all sorts of reasons why a property file might be deployed inside an application.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic