This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Struts and the fly likes how to write properties file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "how to write properties file" Watch "how to write properties file" New topic
Author

how to write properties file

santhoshkumar samala
Ranch Hand

Joined: Nov 12, 2003
Posts: 156

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


santhosh<br />SCJP,SCWCD
Marc Peabody
pie sneak
Sheriff

Joined: Feb 05, 2003
Posts: 4727

In Struts, from your Action classes you can call:
getResources(request)
and will return a MessageResources object created from the ApplicationResources.properties file.


A good workman is known by his tools.
 
wood burning stoves
 
subject: how to write properties file
 
Similar Threads
example for Struts Framework
aboout struts-config and properties file in struts application
Current Working Directory?
Difference between Struts,The Complete Reference and Pro Jakarta Struts?
Any disadvantages of the struts framework.