我有个有趣的问题。当用户单击按钮时,我需要发生两件事:
document
问题是,要生成word文档弹出,在Controller方法中有以下内容:
response.setContentType("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
response.setHeader("Content-Disposition", "attachment;filename=" + templateTitle);
OutputStream out = response.getOutputStream();
InputStream inputStream = session.getServletContext().getResourceAsStream("/resources/files/" + firm.getFolder() + "/" + templateTitle);
if (inputStream != null) {
byte[] wordDoc = readFully(inputStream);
out.write(wordDoc);
out.flush();
}这是可行的,但是,没有显示*.jsp感谢页面。如果我注释掉这段代码,就会显示*.jsp感谢页面。
我的假设是,我正在更改响应属性,这会导致*.jsp不显示。
如何处理这两个过程?
发布于 2012-05-10 13:31:22
你在努力做不可能的事。对于单个请求,您不能有两个响应。
https://stackoverflow.com/questions/10533689
复制相似问题