zl程序教程

您现在的位置是:首页 >  后端

当前栏目

file.getcanonicalpath_maven relativepath

Maven File
2023-06-13 09:14:38 时间

大家好,又见面了,我是你们的朋友全栈君。

Thymeleaf contextPath的获取
1.在html标签中路径使用@{}会自动添加上下文路径

eg:请求/thymeleaf接口 <a th:href=”@{‘/thymeleaf’}”id=”contextPath”>跳转到thymeleaf</a>

2.在js中

eg:请求/thymeleaf接口

//根路径获取相当于jsp的使用${pageContext.request.contextPath}

var rootUrl=/*[[@{/}]]*/ ”; //方法1: var one=/*[[@{/thymeleaf}]]*/ ”; //方法2: var tow=[[${#httpServletRequest.getContextPath()}]]+”/thymeleaf}”;

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。