• struts2里result类型Stream的参数配置


    转自:https://blog.csdn.net/q714699280/article/details/51756126

    contentType

    内容类型,和互联网MIME标准中的规定类型一致,例如text/plain代表纯文本,text/xml表示XML,image/gif代表GIF图片,image/jpeg代表JPG图片

    详细Type

    inputName

    下载文件的来源流,对应着action类中某个类型为Inputstream的属性名,例如取值为inputStream的属性需要编写getInputStream()方法

    实例:

    <param name="inputName">inputStream</param>

    contentDisposition

    文件下载的处理方式,包括内联(inline)和附件(attachment)两种方式,而附件方式会弹出文件保存对话框,否则浏览器会尝试直接显示文件。取值为:

    attachment;filename="struts2.txt",表示文件下载的时候保存的名字应为struts2.txt。如果直接写filename="struts2.txt",那么默认情况是代表inline,浏览器会尝试自动打开它,等价于这样的写法:inline; filename="struts2.txt"

    <span style="font-family: 'Microsoft YaHei', 微软雅黑, Arial, 'Lucida Grande', Tahoma, sans-serif; font-size: 13px; line-height: 24.05px;"><param name="contentDisposition">attachment;fileName=${fileName}</param></span>
    1.  
      <span style="font-family: 'Microsoft YaHei', 微软雅黑, Arial, 'Lucida Grande', Tahoma, sans-serif; font-size: 13px; line-height: 24.05px;"><span style="color: rgb(69, 69, 69); font-family: tahoma, helvetica, arial; font-size: 14px; line-height: 21px;">说明:attachment:弹出 是否下载的询问.默认为inline</span>
    2.  
      </span>

    bufferSize

    下载缓冲区的大小

    在这里面,contentType属性和contentDisposition分别对应着HTTP响应中的头Content-TypeContent-disposition头。

    <span style="font-family: 'Microsoft YaHei', 微软雅黑, Arial, 'Lucida Grande', Tahoma, sans-serif; line-height: 24.05px;"><span style="font-family: 'Microsoft YaHei', 微软雅黑, Arial, 'Lucida Grande', Tahoma, sans-serif; font-size: 13px; line-height: 24.05px;"><param name="bufferSize">4096</param></span></span>
    <param name="bufferSize">4096</param>
  • 相关阅读:
    Mysql第八天 分区与分表
    ios—项目开发需求文档
    spark资料下载
    网络爬虫:使用多线程爬取网页链接
    调用微信高级群发接口--视频群发接口出问题(微信官方文档错误纠正)
    享元模式
    在JAVA中怎样跳出当前的多重嵌套循环?
    获取个人借阅信息---图书馆client
    IOS 以随意点为圆心 旋转UIView
    ESP8266学习笔记4:ESP8266的SmartConfig
  • 原文地址:https://www.cnblogs.com/sharpest/p/9804797.html
Copyright © 2020-2023  润新知