Spring boot Spring MVC,Thymeleaf-事件打开复选框

Spring boot Spring MVC,Thymeleaf-事件打开复选框,spring-boot,spring-mvc,thymeleaf,spring-webflux,Spring Boot,Spring Mvc,Thymeleaf,Spring Webflux,Spring MVC、Thymeleaf和WebFlux(因为WebClient) 在index.html <input type="checkbox" th:checked="${isActive}"/> 不确定复选框需要哪些其他属性 我想实现的是,每当单击复选框时(值从true->false或false->true更改),都必须执行对后端的另一个REST调用。或者至少必须调用IndexController或@Servicebean中的

Spring MVC、Thymeleaf和WebFlux(因为WebClient)

index.html

<input type="checkbox" th:checked="${isActive}"/>

不确定复选框需要哪些其他属性


我想实现的是,每当单击复选框时(值从true->false或false->true更改),都必须执行对后端的另一个REST调用。或者至少必须调用
IndexController
@Service
bean中的一个方法,然后该方法可以执行REST调用。

Thymeleaf不是脚本语言,而是服务器端模板解析器。当Thymeleaf完成呈现页面时,服务器将其呈现为常规HTML,所有客户端事件都应使用与客户端相关的技术进行处理。例如,如果需要处理复选框上的“click”事件并向服务器发送请求,可以使用JS连接到“onchange”事件并向rest控制器发送ajax请求。
<input type="checkbox" th:checked="${isActive}"/>