使用 response.outputStream 后我需要重定向我是 grails 的新手,所以我可能不知道是否有一种简单的方法可以做到这一点。或者,如果它甚至是可能的。这是片段:
def filename = "ProgramA14_"+DASelected+"_backup.csv"
def filecontent = response.outputStream
response.setHeader("Content-disposition", "attachment; filename="+filename)
response.contentType = "text/csv"
filecontent << "program,da,area,date,forecastedReportedCumulative,forecastedReportedLow,forecastedReportedUpper,forecastedCorrectedCumulative,openPronto,openProntoLow,openProntoUpper,forecastedReportedWeekly,forecastedCorrectedWeekly\n"
flash.message = "Sample Flash message."
redirect(action:list, params:[programA14InstanceList: programA14DA, programA14InstanceTotal: programA14DA.count()])
}