当前位置:网站首页>thymeleaf如何取url中请求参数值?

thymeleaf如何取url中请求参数值?

2022-06-23 09:48:00 Roc-xb

需求:例如请求url链接为:http://localhost:8080/community/service?cid=1

如何取到url中的cid参数值呢?

一、HTML取值

<span th:text="${param.cid}"></san>

或者

<span>[[${param.cid}]]</span>

二、 JS取值

<script>
let cid=[[${param.cid}]];
console.log(cid);
</script>

原网站

版权声明
本文为[Roc-xb]所创,转载请带上原文链接,感谢
https://yang-roc.blog.csdn.net/article/details/125401847