• Post Reply Bookmark Topic Watch Topic
  • New Topic

Property Files in Web Apps  RSS feed

 
Timothy Mozee
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am creating a web application that contains a few JSP pages, a few beans and a handful of helper classes. I would like to use a property file to make the application configurable, however, I'm not sure of the directory that the final application will be installed/deployed. I have read that the JSP pages will be fine as the JSP container will resolve references to other JSP pages, HTML and defined servlets. So, this leaves the helper classes. What is a good approach for ensuring that the helper classes can access property files when the absolute path(s) may not be known?
Any comments, book and chapter references, general tips, etc would be appreciated.
Thanks,
-timmo
 
R K Singh
Ranch Hand
Posts: 5390
1
Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can have yourContext/config folder, inside that folder you can keep all prop files.
OR you can simply keep prop file inside the WEB-INF folder.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
call them as a ResourceBundle and put them in WEB-INF/classes under your web app.
That way you don't have to know the absolute path and can access the properties file as if it were a class (so using directory.filename using WEB-INF/classes as the root and omitting the .properties extension).
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!