Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to write properties file

 
santhoshkumar samala
Ranch Hand
Posts: 156
Eclipse IDE Hibernate Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

generally when we see log4j or hibernate and also in struts framework we have ".properties" file and we mention key value pairs in that properties file. but what If I want to write my own ".properties" file say dbconnection.properties, then how to read it from a java file.I am not getting any Idea, I know if we mention the database connection etc in xml file the parsers will help, but how can we read a ".properties" file? how is it possible in struts framework? because it has "applicationresources.properties" file

thanks in advance
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Struts, from your Action classes you can call:
getResources(request)
and will return a MessageResources object created from the ApplicationResources.properties file.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic