I'm using T5.2.4
I have a page with ajax (zones and actions) and I have to generate a excel
file when a user clicks on actionlink. If I add a zone in the actionlink
that generates the StreamResponse the excel file is never generated but if I
use an actionlink without zone the excel file is generated but the ajax
actions stop working.
My stream response:
public class ExcelStreamResponse implements StreamResponse {
private ByteArrayOutputStream baos;
private String filename;
public ExcelStreamResponse(ByteArrayOutputStream baos, String filename)
{
this.baos = baos;
this.filename = filename;
}
@Override
public String getContentType() {
return "application/vnd.ms-excel";
}
@Override
public InputStream getStream() throws IOException {
return new ByteArrayInputStream(baos.toByteArray());
}
@Override
public void prepareResponse(Response response) {
response.setHeader("Content-Disposition", "attachment; filename=" +
filename + ".xls");
}
}
My tml:
reporteCostosExcel
My page:
Object onActionFromReporteCostosExcel(Integer idEncuestador, Date fechaIni,
Date fechaFin) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ExcelStreamResponse excelStream = new ExcelStreamResponse(baos,
"resumen_costos");
excelManager.creaReporteCostosExcel(idEncuestador, fechaIni,
fechaFin, baos);
return excelStream;
}
How can I solve it, anyone may help me? Thanks in advance
--
View this message in context:
http://tapestry.1045711.n5.nabble.com/Problem-with-StreamResponse-and-Ajax-tp3316957p3316957.html
Sent from the Tapestry - User mailing list archive at Nabble.com.