Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to read values from .properies file in Jasper report

 
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 222
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Wanna see my flashlight? How about this tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic