首页 > 编程语言 > 详细

SpringBoot+Thymeleaf->问题1

时间:2018-04-25 16:56:39      阅读:279      评论:0      收藏:0      [点我收藏+]
H5页面

  <img th:src="files+‘/‘+${avatar}" ></img>
 <span th:text="${session.user.userName}+‘,您好!‘">张三,您好</span> 

服务端:

类上面

@RequestMapping("/files")

方法上面

@GetMapping("/{filename:.+}")
        @ResponseBody
        public ResponseEntity<Resource> serveFile(@PathVariable String filename) {
                Resource file = storageService.loadAsResource(filename);
                return ResponseEntity.ok().header(HttpHeaders.CONTENT_DISPOSITION,
                                "attachment; filename=\"" + file.getFilename() + "\"").body(file);
        }

 主要是 url 拼接问题

SpringBoot+Thymeleaf->问题1

原文:http://blog.51cto.com/360douruanliang/2107760

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!