代码
<%@ page import="java.io.OutputStream" %>
<%--
Created by IntelliJ IDEA.
User: czy
Date:
2010-3-31
Time:
23:20:32
To change
this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=gbk" language="java" %>
<html>
<head><title>Simple jsp page</title></head>
<body>
<%
String fileName
= "hello.txt";response.setContentType("text/plain");
response.setHeader(
"Location", fileName);
response.setHeader(
"Content-Disposition", "attachment; filename=" + fileName);
OutputStream outputStream
= response.getOutputStream();
String s
= "hello world";
byte[] buffer = new byte[1024];

outputStream.write(s.getBytes());
outputStream.flush();
outputStream.close();
out.clear();
out
=pageContext.pushBody();
%>
</body>
</html>

 

 

 

相关文章:

  • 2021-10-29
  • 2021-12-26
  • 2021-09-04
  • 2021-10-20
  • 2021-06-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-29
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案