File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes GWT and the fly likes JasperReports with GWT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » GWT
Bookmark "JasperReports with GWT" Watch "JasperReports with GWT" New topic

JasperReports with GWT

Timmy Blue

Joined: Oct 25, 2011
Posts: 2
Hi folks,

I try to allow a GWT user to generate dynamically a PDF File using some data and a .jasper file. I tried to do this on my
servlet, and then let the user download the generated PDF, but my servlet isn't allowed to load and save files. So I
decided to generate the PDF at client side.

Now I've got the problem to get the Jasper file to the client. Should the client download it and then work with it and if
yes how could I do this?

Or is there a possibility to get a binary file to the client from scratch?

Thanks in advance Jimmy
abani patra
Ranch Hand

Joined: Oct 11, 2011
Posts: 70
I would also like to know its answer ,although I have used jasper report in spring I have not done using GWT
Timmy Blue

Joined: Oct 25, 2011
Posts: 2
Hi abani,

I found a solution to get the PDF as byte stream to the client. I defined a webservice which returned
a byte array that represents the PDF. You can do this by calling

By this means I was indeed able to get the PDF as stream, but found no way to display this out of GWT.
(Be sure to get the jasper-File in the root of your classes-Folder!!! So you can load it)

I found a ploy to save data on the file system of your server. Create manually a file on the server
in your classes-folder. Now you can load it in the servlet using new File() and change its content.
You are however only able to save a limited amount of files.

After doing so you can load the pdf by calling a servlet in GWT with
This Servlet has to read the file and return it as type "application/pdf".

I'm sorry that I found no easier solution.

Bye Jimmy
Alex Pato

Joined: Nov 08, 2011
Posts: 9

I'm new to the boards, as well as GWT. I'm planning to build a Java EE application using EJB and Web Services with a GWT front end. My application needs to build reports from a data source, and was wondering if there are any report builders that work hand in hand with GWT. I see you have gone into it in detail, but I just need to know if this is possible before deciding to start learning GWT.

I looked at it briefly and had difficulty going from one page to another, basically needing to crowd all my controls on the default GWT home page, if I may. So that is where I am at with regards to GWT.

So kindly let me know if this is possible before I start learning GWT as I have a short deadline to meet. If there are some frameworks such as smartGWT that can handle this, please let me know as well. Surprisingly, I have had much luck searching for information on Google.

Best regards.
Miku Ranjan
Ranch Hand

Joined: Oct 11, 2011
Posts: 98
Hi Timmy,
Can you show the webservice detail code.
Alex Pato

Joined: Nov 08, 2011
Posts: 9
At the moment, no. In fact, I have just decided on what operating system I should use for my server. It may take time, but I wanted to know whether it was possible to develop reports, generated from a data source, that is triggered using a GWT application. Otherwise, I may just end up using Swing.

One more thing I wanted to ask ... and as I have very little to no experience with GWT, please bare with me. Regarding the performance of a production system, in comparison to a server that would just supply data via web services to swing applications on various user computers, how would you rate GWT? I know there will be more load on the server. The one I'm working on has a Pentium Dual Core E5800 processor with 4GB of RAM, which should be serving say a maximum of 40-50 users at a time. Which would you recommend from a performance perspective?

Best Regards.
I agree. Here's the link:
subject: JasperReports with GWT
It's not a secret anymore!