File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Arguments to Properties File

 
Karthik Rajendiran
Ranch Hand
Posts: 217
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends,

I have one requirement with resources or properties file

I have one properties file, with key value pairs like this

error.productid.activation=your {0} is not yet activated.
error.productid.campaignid.disable=your {0} and {1} is not enabled.


I have to pass values dynamically to this key while fetching value. How to pass and how to do this in java program.
 
Joanne Neal
Rancher
Pie
Posts: 3742
16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you need the MessageFormat class
 
Karthik Rajendiran
Ranch Hand
Posts: 217
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks sir,

One clarification,
I have 3 files like
messagetemplate.properties
messagetempalte_en_GB.properties
messagetemplate_en_ie.properties

Can we make the messageformat to pick the correct file itself. or should i have to pick the file and get the key and send to messageformat?
 
Rob Spoor
Sheriff
Pie
Posts: 20368
43
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out ResourceBundle.
 
Ramya Chowdary
Ranch Hand
Posts: 252
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator



for web applications you can try much simpler format tag


[ July 28, 2008: Message edited by: Pratap koritala ]
 
Karthik Rajendiran
Ranch Hand
Posts: 217
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. Really Helpful
 
Ragupathirajan Venkatesan
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

Please advice how to pass the values dynamically to key attribute in the <fmt:message key='">. Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic