FHXISDOG

just for fun

GuangZhou, China
  • Home
  • Archives
  • Categories
  • Tags
  • kviccn
  • About

公告

just for fun

分类

  • docker1
  • flutter1
  • git1
  • jvm1
  • linux6
  • nacos1
  • orther1
  • skywalking1
  • smicroservices1
  • spring-boot4

标签

  • android1
  • docker1
  • emacs2
  • flutter1
  • git1
  • i3wm2
  • java8
  • jvm1
  • linux7
  • manjaro2
  • maven1
  • modmap1
  • nacos1
  • orther1
  • shadowsocks1
  • skywalking1
  • smb1
  • smicroservices1
  • spring-boot5
  • spring-cloud2
  • vpn1
  • vue1

文章目录

Spring Boot Thymeleaf 引用contexpath

2019-09-04 spring boot java spring boot 0 评论 字数统计:97字 阅读时长:1分

spring boot 设置contextPath后,如果js中的请求路径不设置,会造成404的问题。 设置方法:

在html页面header中添加配置:

<meta name="ctx" th:content="${#httpServletRequest.getContextPath()}" >

js中引用:

 var ctx = $("meta[name='ctx']").attr("content");

变量ctx就是contextPath

  •   上一篇
  • 下一篇  
  • [ 文章目录 ]

感谢您的支持,我会继续努力的!

扫码支持

扫码打赏, 多少你说了算~

打开支付宝扫一扫,即可进行扫码打赏哦~

扫码支持

扫码打赏, 多少你说了算~

打开微信扫一扫,即可进行扫码打赏哦

  • 支付宝
  • 微信支付
©2017 - 2020
Theme by xiaoheiAh base on pure.