一、事件传值
Thymeleaf:如何用 th:onclick 给方法传递参数值
一、th:onclick= "|javascript:edit('${noticemodel.mid}')|"
二、th:onclick= "|edit(${noticemodel.mid})|"
二、解决script引用 ,引用型变量,解析Object内存地址解析失败
var 变量名 = [[${后台保存变量}]]
 for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/user/edit.html]")] with root cause
org.springframework.expression.spel.SpelEvaluationException: EL1011E: Method call: Attempted to call method getId() on null context object
at org.springframework.expression.spel.ast.MethodReference.throwIfNotNullSafe(MethodReference.java:154) ~[spring-expression-5.2.10.RELEASE.jar:5.2.10.RELEASE]
解决方案:
加上"?"
四、thymeleaf标签中的值爆红
解决方案:
开头加上:<!--suppress ThymeleafVariablesResolveInspection -->
说明:以上均是自己踩过的坑,忘各位少走弯路。。。