aspose file tools
The moose likes IDEs, Version Control and other tools and the fly likes How to read values from .properies file in Jasper report Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Reply Bookmark "How to read values from .properies file in Jasper report" Watch "How to read values from .properies file in Jasper report" New topic
Author

How to read values from .properies file in Jasper report

samir ware
Ranch Hand

Joined: Jul 27, 2005
Posts: 186
Hi all,
I am tring to create the Jasper report with the i-report IDE.Can anyone please tell me how can I read the value from the resource bundle.

Thanks in advance
Regards
samir
Ankit Doshi
Ranch Hand

Joined: Dec 04, 2002
Posts: 222
Not sure about the i-report IDE, but for ResourceBundle, as long as you have put the properties file in any of the directories which is in classpath, you should be able to load it.

Example code:
Assuming the Config.properties file is in a directory, which is in classpath.


Hope this helps.
samir ware
Ranch Hand

Joined: Jul 27, 2005
Posts: 186
thanks for the reaply ankit ....but I need to know how to achive the perticular thing from the i-report editor. And I already kept my .property file in class path. Is there any way out for the same
Is there any link that will give an example for the same
Thanks and regards
Samir
Ankit Doshi
Ranch Hand

Joined: Dec 04, 2002
Posts: 222
Can anyone please tell me how can I read the value from the resource bundle.


I need to know how to achive the perticular thing from the i-report...



If your question is just about how to read the value from resource bundle, all you need to do is put the code mentioned in my earlier post and just put the property file in the classpath. No matter which IDE you use, if you're doing these two steps, it should work.

If this doesn't help, where exactly are you stuck?
samir ware
Ranch Hand

Joined: Jul 27, 2005
Posts: 186
well Ankit....This is the first time I am using the Jasper report, so my question may sound somewhat stupid.Whatever I am doing right now is just try to demostrate the Jasper report through the i-report. What I get after the compilation is the .xml file which I have not integratd yet with the java code.After the click on run button ..I get all the stuff as per requirmwent in PDF or word format. Now my requrment is to read the values from the resource bundle. I have gone through the code which you posted last time . But for sure I won't be able to write such type of java code in XML file.
Infact there is a variable called REPORT_RESOURCE_BUNDLE and REPORT_LOCALE which I can see in i-report editor under "parameter" tab . I think these are the two variables to which I have to pass the path of .property file.But I dont know how.
Please help me out with the same
Vaasu Dev
Greenhorn

Joined: Sep 11, 2006
Posts: 3
Hi,
I thinkthis code is helpful for you,
String language = new String("en");
String country = new String("US");
Locale currentLocale = new Locale(language, country);
ResourceBundle message = ResourceBundle.getBundle ("MessagesBundle_en_US",currentLocale);
String msg1 = message.getString("greetings");
Place key, value pair in this file MessagesBundle_en_US.properties file
like
greetings = Hello
samir ware
Ranch Hand

Joined: Jul 27, 2005
Posts: 186
hi vasu,
thanks for yor kind help.Even ankit has given me the same solution.But I have given the explanation in the last post why I cant make the use of that code.Is there any alternative or any link as such from where I can get the proper documentation of i-report or jasper report

thanks and regards
samir
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: How to read values from .properies file in Jasper report
 
Similar Threads
HTML from jasper
Call report using JSF and Jasper Reports
Problem in passing JRBeanCollectionDataSource as parameter to jasperreport
how to prevent from closing java file?
excel and jasper reports