• 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 display Parameter in JasperReport?

 
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello

I am passing UserName as a parameter.

Now I want to display it in the report.

What I have to do? Do I have to use Static Text Or Textfiled? Also, How to map parameter with it?

Thanks in advance.

Reg,
Chetan
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
you should:
1) define the parameter in you report definition (.jrxml file; in <jasperReport>...</jasperReport>
F.e.:
<jasperReport>
......
<parameter name="userName" class="java.lang.String">
</parameter>
....
</jasperReport>
2) in your .java, where you compile and fill your JasperReport, you should create a Map of all parameters and pass it as a parameter to the FillManager
F.e.:
Map parameters = new HashMap();
parameters.put("userName", userName);

JasperPrint jasperPrint = JasperFillManager.fillReport(fileName, parameters, getConnection());
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic