xiaochong / zkui

Grails ZK UI Plugin
http://grails.org/plugin/zkui
GNU Lesser General Public License v3.0
24 stars 8 forks source link

response in zkui #96

Closed hahnz closed 12 years ago

hahnz commented 12 years ago

Hi Xiao Chong, I've tried to make report in zkui using jasper report plugin. but I cant use response to download the report..

here the sample code

def reportDef = new JasperReportDef(name:'reportUnavailableDoc.jrxml', fileFormat:JasperExportFormat.PDF_FORMAT ) response.setContentType("application/pdf") response.outputStream << jasperService.generateReport(reportDef).toByteArray()

the zkui doesnt recognize response, actually I`ve import javax.servlet.http.HttpServletResponse and already define it.

but it cannot worked too.. it say output doesnt recognize on null object. what should I do?

xiaochong commented 12 years ago

There is no response in composer,but you can use 'redirect' method redirect to the report controller. You can write your report code in the grails controller.

aaloise commented 12 years ago

You can do something link this:

def reportDef = new JasperReportDef(name:'newReport1.jasper', fileFormat:JasperExportFormat.PDF_FORMAT, parameters:[campus_id:user.campus.id+""])

Filedownload.save(jasperService.generateReport(reportDef).toByteArray(),"application/pdf", "Necessidades")

Filedownload belongs to ZK api

hahnz commented 12 years ago

I've done the xiaochong way, and its worked fine.. I may be will try aaloise way too... thx for the alternative.. =D