Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Problem Reading Property File

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all
i have a servlet which will connect to Database and fetches some DATA.i have a dbconnection.properties which will have the connection string ,query,and.....the problem is the servlet is not able to read the properties file.actually where we can place the properties file.at present i have this servlet in project root directory.
PS:
when i put this properties file in WEB-INF\Classes its working. but that is not a right way to do it.
Help ME,
thanks and regards
Saratahy
 
Ranch Hand
Posts: 645
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can u pl tell y is it wrong way to put properties file under web-inf/clasess ?
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Translation:
u = you
pl = please
y = why
clasess = classes
Please reduce the use of contractions. When you combine accidental spelling and grammar mistakes with people from around the world who may not have English as their primary language, contractions just make posts harder to understand and should be avoided.
The point is well made though: if it works, why is WEB-INF/classes the wrong place for the properties file?
 
Praful Thakare
Ranch Hand
Posts: 645
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank You (thanx ) David,
I will keep This In mind.
cheers
Praful
 
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi parth..
you can do this in following manner

so in this case the name of the properties file should be PropConfig.properties and in my case it is in the conf directory of the root of your application.
and it is not wrong to put the properties file in classes directory.. only thing is that putting it in seperate directory makes it more viewable and seperates the code files from different files as we keep our HTML file, JSP files, and image files in different folder though it is not wrong to keep them together.
i hope i have answered correctly. if doubt please revert back
Thanks
Amit
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic