Jump to content
Changes to the Jaspersoft community edition download ×

How do we access values of a bean sent as parameter to Jasper Report?


shravanthit

Recommended Posts

Hello all,

I just started experimenting with Jasper for a project requirement and stuck on the below issue.

How do we access values of a bean sent as parameter to Jasper Report?

I have to display the data of a model (which is not a collection) in Jasper Report. I pass the model to the Jasper Report in parameters in a Map.

Map<String,Object> params = new HashMap<String,Object>();
params.put("object", object);
[/code]

Now this object has fields whose data I need to display in the Jasper report header section.

like in jsp we do ${object.name}, ${object.phone} etc., how do we achieve this in Jasper Report.

I tried doing $P{object.name} but it doesn't work. Can anyone please let me know how to achieve this.

Thanks in advance.

Laxmi.

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Map<String, Object> params = new HashMap<String, Object>();

params.put("object", "teste");

 

for (Map.Entry<String, Object> params2 : params.entrySet()) {

String Key = params2.getKey();

Object val = params2.getValue();

}

 

 

i think this can help you

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...