我正在尝试在脚本标签中发送一个参数,如下所示:
<script th:src="@{/js/myScript.js(arg0=${value})}"></script>其中 value 是以下结果:hasAuthority('USER')
所以,我试过这个:
<script th:src="@{/js/myScript.js(arg0=${hasAuthority('USER')})}"></script>但这不起作用:
Caused by: org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating SpringEL expression: "hasAuthority('USER')" (template: "groups" - line 61, col 9)
Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1004E: Method call: Method hasAuthority(java.lang.String) cannot be found on org.thymeleaf.spring4.expression.SPELContextMapWrapper type我之前使用过这个函数来显示 div 没有问题:
<li sec:authorize="${hasAuthority('ADMIN')}">
墨色风雨
牧羊人nacy
随时随地看视频慕课网APP
相关分类