protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub /*
* 输出一个excel
* */
response.setContentType("application/vnd.ms-excel");
PrintWriter out = response.getWriter();
out.println("\tQ1\tQ2\tQ3\tQ4\tTotal");
out.println("Apples\t90\t40\t49\t55");
out.println("Oranges\t90\t40\t49\t55");
}

返回一个excel表格

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
response.setContentType("image/jpeg");
InputStream in = this.getClass().getClassLoader().getResourceAsStream("t.jpg");
byte[] b = new byte[in.available()];
in.read(b);
OutputStream out = response.getOutputStream();
out.write(b);
out.close();
in.close(); }

显示一张图片

Servlet_ResponseHeader的更多相关文章

  1. JQ二级菜单练习之一~~~

    <div class="nav"> <ul> <li><a href="#">首页</a> < ...

随机推荐

  1. 阅读 LdrInitializeThunk

    参考: http://blog.csdn.net/hw_henry2008/article/details/6568255 Windows 的 DLL 装入(除 ntdll.dll 外)和连接是通过 ...

  2. VS2013编译FileZilla0.9.44

    2014年,FileZilla更新了一下,到了44版本了,貌似也是用VS2013的工程做的项目,所以下载了server的安装包,然后安装SourceCode即可(需要安装InterFace,是安装必选 ...

  3. 激活OFFICE2010时,提示choice.exe不是有效的win32程序

    我在安装office2010破解版时,提示choice.exe不是有效的win32应用程序 删除choice.exe再激活,按提示找到目录删掉这个文件,需要设置显示隐藏文件夹

  4. wordpress安装插件--su

     Add to Any: Subscribe Button 让读者方便的订阅你的博客到任何Feed阅读器 Google XML Sitemaps 生成完全兼容各大搜索引擎的Sitemaps/网站地图. ...

  5. 通过onActivityResult()先跳转到联系人界面,然后把传回来的手机号显示到应用的EditText上

    <pre name="code" class="plain"><pre name="code" class="p ...

  6. Sublime Text 最佳插件列表

    http://blog.jobbole.com/79326/ 推荐!Sublime Text 最佳插件列表 2014/07/25 · 工具与资源 · 26.1K 阅读 · 2 评论 · Sublime ...

  7. mysql deadlock

    http://database.51cto.com/art/201108/286325.htm 这篇文章说的很清楚,记下来. 原因分析: 当“update tab_test set state=106 ...

  8. ST Visual Programmer批量烧写教程

    源:ST Visual Programmer批量烧写教程 参考:为什么STM8 写了保护后,用ST Visual Programmer 无法重新烧录程序? 首先要说下为什么要建立烧写工程呢- -原因只 ...

  9. Struts2.3.16日志(中)

    Result Configuration --Result 配置 当一个操作类方法完成后,它将返回一个字符串.字符串的值是用来选择一个元素的结果.一个操作映射的结果往往会有一组代表不同的可能的结果.一 ...

  10. 配置glance使用NFS后端

    首先先使用“glance image-delete”命令删除所有镜像,释放磁盘空间. 停止glance服务:service openstack-glance-api stopservice opens ...