Về cơ bản, bạn có thể sử dụng các ví dụ như được đề cập trên tài liệu plugin (http://grails.org/plugin/birt-report). 1. Để tạo báo cáo HTML sử dụng. Nhận thấy rằng BIRT tạo ra HTML chứ không phải GSP. bạn có thể hiển thị HTML đầu ra bên trong trang GSP của mình.
// generate html output and send it to the browser
def show() {
String reportName = params.remove('id')
String reportExt = 'pdf'
params.remove('action')
params.remove('controller')
params.remove('name')
def options = birtReportService.getRenderOption(request, 'html')
def result=birtReportService.runAndRender(reportName, params, options)
response.contentType = 'text/html'
response.outputStream << result.toByteArray()
return false
}
tạo pdf để tải về
def downloadAsPDF() { Chuỗi REPORTNAME = params.remove ('id') Chuỗi reportExt = 'pdf' params.remove ('hành động') params.remove ('controller') params.remove ('name') def options = birtReportService.getRenderOption (yêu cầu, 'pdf') def result = birtReportService.runAndRender (reportName, params, options) response.setHeader ("Nội dung bố trí", "tệp đính kèm; filename = "+ REPORTNAME +" "+ reportExt);. Response.ContentType = 'application/pdf' Response.OutputStream < < result.toByteArray() trả về false }
tại sao câu hỏi này được bảo vệ ? câu trả lời ở đâu? – aldrin