File tempFile = new File(fileName);// 构造临时对象
      // String savePath=tempFile.getName();
      // //返回上传文件在客户端的完整路径名称
      // request.setAttribute("filename", savePath);

//File file = new File(request.getRealPath("/upload"), //此句报错。
      File file = new File(request.getSession().getServletContext().getRealPath("/upload"),//改成这句。就Ok咯
        tempFile.getName()); // 获取根目录对应的真实物理路径

The method getRealPath(String) from the type ServletRequest is deprecated相关推荐

  1. Java问题集锦--The type StringEscapeUtils is deprecated

    The type StringEscapeUtils is deprecated" 之前一直使用commons-lang3-3.x.jar 这个jar包里面的 org.apache.comm ...

  2. MapReduce操作时Error:The method setInputPaths(JobConf, String) in the type FileInputFormat is not

    问题描述 今天在写java API的MapReduce操作时,出现了Error:The method setInputPaths(JobConf, String) in the type FileIn ...

  3. Android NDK 【错误】The method loadLibrary(String) is undefined for the type Settings.Syste

    [错误]The method loadLibrary(String) is undefined for the type Settings.System [解决方法] 不要加入包import andr ...

  4. attempted to return null from a method with a primitive return type (int).

    错误产生的场景 dao层接口如下 int getResourceDataNumsByTitle(String title); mapper.xml 中sql语句如下 <select id=&qu ...

  5. Failed to convert value of type 'java.lang.String' to required type 'java.util.Date

    异常原因:Controller层获取JSP页面请求参数是String类型,而在Controller层接收时使用Date类型,属于方法参数类型不匹配异常 警告: Failed to bind reque ...

  6. spring:Failed to convert property value of type ‘java.lang.String‘ to required type ‘java.util.Date‘

    前言 springboot有接口日期转换的经典问题,给Entity加@JsonFormat解决了输出json日期格式的输入输出问题,但是解决不了非@RequestBody/也就是普通表单提交的日期格式 ...

  7. 关于mybatis的报错 attempted to return null from a method with a primitive return type (int)

    https://blog.csdn.net/kisscatforever/article/details/77801060 一.前言       在往常敲代码的时候没有留意过int和Integer的区 ...

  8. method is ambiguous for the type

    The method list(String, Object[]) is ambiguous for the type BaseHibernateDao<M,PK> after  -vma ...

  9. mapper method attempted to return null from a method with a primitive return type (int)

    一.场景和背景 工具:mybatis + pgsql dao代码: int selectMaxAgeBySex(String sex); 查询性别是女生的最大年龄 sql: <select id ...

最新文章

  1. Scrum企业实践-Leangoo敏捷工具
  2. OPA 18 - iTeardownMyAppFrame
  3. python加权最小二乘_【Python】统计科学之加权最小二乘法
  4. 测试nignx php请求并发数,nginx 优化(突破十万并发)
  5. 实现工具自由!开源的桌面工具箱
  6. node.js——麻将算法(七)简易版麻将出牌AI2.0
  7. 微软宣布 Windows 10X:用于可折叠 PC 的新操作系统
  8. 苹果推出新款iPad Air和iPad mini,升级A12处理器
  9. 三十天学不会TCP,UDP/IP网络编程-IP头格式祥述
  10. c语言怎么添加搜索功能,C语言实现二叉搜索树的创建、插入、删除和查找
  11. Golang 入门系列(十三)用Beego开发web应用
  12. 洛谷P1447 [NOI2010]能量采集(容斥)
  13. java list对象转json_java中List对象转换为JSON对象
  14. js数据的编码和解码
  15. Mini-C编译器设计与实现 文档+任务书+评价表+PPT+项目源码
  16. tf1.x版RandLA-Net源码解读(1):数据预处理
  17. 虚幻4渲染编程(环境模拟篇)【第二卷:体积云天空模拟(2)---3D体纹理低云】...
  18. RTB广告展示分步说明
  19. 遥想大肠包小肠----python装饰器乱弹
  20. JavaScript中let的用法

热门文章

  1. 点石互动--robin之:渡虎谷SEO大赛第二阶段总结
  2. Windows Server 2003 R2 With Sp2 序列号
  3. ACL最全详解:原理及作用、分类及特点、配置及需求
  4. VuePress 侧边栏使用详解
  5. 戒除浮躁(不知作者但是超级棒)
  6. MySQL备份和恢复
  7. python课后练习
  8. 利用脚本轻松实现视频处理
  9. winform 上加ToolStrip时图标大小调整
  10. 一、Vue环境搭建及基础用法