Sending data to report to display

Hello everyone 

i want to display report in my web application using Visualize.js and jasper report server , i configure all thing (server , frontend, backend ..). and the report connect to database and display the report ,but i do not want jasper server to connect to my database . i want to send the data to jasper server and render the report in my web application using Visualize.js. 

is there any way to send data to report , some thing like sending paramter to server & report.

thank you .

ali.shreef's picture
Joined: May 4 2019 - 4:27am
Last seen: 3 years 10 months ago

4 Answers:

No. It's the JasperReports Server that fetches the data.

If you want to push the data, you'll need to write a servlet to accept the data and pass it to JasperReports library as a data source (such as csv and beans) and generate a report. 

hozawa's picture
170495
Joined: Apr 24 2010 - 4:31pm
Last seen: 3 years 9 months ago

thank you for your answer hozawa .

colud you provide me with example or documentation to accomplish this ?

is it posible to do it with JSON?

 

thank you again.

ali.shreef's picture
Joined: May 4 2019 - 4:27am
Last seen: 3 years 10 months ago

I have an old stackoverflow post explaining how to push XML/JSON data to a report deployed in JasperReports Server and some basic ways to test it:

https://stackoverflow.com/a/37441567/5882963

That could be a starting point.

narcism's picture
5510
Joined: Nov 22 2010 - 12:39am
Last seen: 7 hours 17 min ago

Do you want to send your json every time you generate a report or want to update the data so other users would be able to view the report with the updated data?

narcism way of passing json string via parameter would work when json string is passed each time the report is to be generated.

If you want to update the data used to generate a report, all that's required is to create a simple servlet to receive the json data and save it in a data source. (e.g. update data in in memory database or beans.)

Following page contains a simple example of a servlet. It's possible to deploy the servlet on the same Tomcat as JasperReports Server.

https://javatutorial.net/java-servlet-post-example

hozawa's picture
170495
Joined: Apr 24 2010 - 4:31pm
Last seen: 3 years 9 months ago
Feedback