Struts2 文件上传为什么会自动生成对应file的fileName和ContentType
来源:互联网 发布:mysql读写分离原理 编辑:程序博客网 时间:2024/05/17 02:07
Struts2 文件上传为什么会自动生成对应file的fileName和ContentType
根据官方文档来说,这是因为使用了FileUploadInterceptor拦截器,然后又把他们放到了Param中,所以在action中能取得到.下面是关键的代码:
...public String intercept(ActionInvocation invocation)...String contentTypeName = (new StringBuilder()).append(inputName).append("ContentType").toString();String fileNameName = (new StringBuilder()).append(inputName).append("FileName").toString();...Map params = ac.getParameters();params.put(inputName, ((Object) (acceptedFiles.toArray(new File[acceptedFiles.size()]))));params.put(contentTypeName, ((Object) (acceptedContentTypes.toArray(new String[acceptedContentTypes.size()]))));params.put(fileNameName, ((Object) (acceptedFileNames.toArray(new String[acceptedFileNames.size()]))));
1 0
- Struts2 文件上传为什么会自动生成对应file的fileName和ContentType
- struts2文件上传file,contentType,fileName出现null
- struts2文件上传file,contentType,fileName出现null
- struts2上传的Web文件ContentType类型大全
- struts2上传的Web文件ContentType类型大全
- struts2上传的Web文件ContentType类型大全
- struts2上传的Web文件ContentType类型大全
- struts2上传的Web文件ContentType类型大全
- java 中string filename和file filename 创建文件的区别
- 文件格式和对应的ContentType 对应表
- Web文件对应的ContentType类型大全
- Mybatis Generator自动生成对应的文件
- 获取file文件的ContentType文件类型
- contentType对应的文件类型 :
- FCK和struts2整合,文件上传的时候出现error on file upload,error number:203
- 使用Mybatis生成工具自动生成实体类和对应的mapper映射文件以及接口文件
- struts2文件上传,文件类型 allowedTypes对应
- struts2上传文件的File属性如何装载
- 如何选择项目负责人?选谁做项目负责人?
- struts.xml constant说明
- 我的第一篇博客
- 使用spring boot 改造老项目,多个数据源问题
- json 数据 添加 删除 排序
- Struts2 文件上传为什么会自动生成对应file的fileName和ContentType
- Java框架(2)
- 杭电 hdu 1877 又一版 A+B 递归转进制
- java线程池使用说明
- Android UI(Button)详解
- linux下redis的安装与使用
- tcp协议实现C/S通信(代码)
- ios——AFNetworking的简单使用
- 设计模式(十三) 代理模式和Java动态代理