Spring Boot 和 Thymeleaf 中的 Actionlistener
Actionlistener in Spring Boot and Thymeleaf
我目前正在尝试使用 Spring Boot,并使用 Spring Boot 和 Thymeleaf 开发了一些类似 CRUD 的小型应用程序 - 似乎运行良好。
但是在 Spring Boot with Thymeleaf 中没有任何方法可以实现 ActionListeners 或 ClickListeners,就像您可以使用传统的 Java GUI 组件或 Vaadin 一样?
此致
Web 技术不同于桌面技术。计算机是分开的:您的网络浏览器在您的计算机上,网页在服务器上。当您单击一个按钮时,Web 浏览器会创建一个 TCP/IP "internet" 数据包并将其发送到服务器,以便 Web 应用程序可以决定如何处理它。
在 Java/AWT 桌面应用程序中,使用 ActionListeners,单击按钮最终会调用计算机上 运行 的应用程序。即使它可以通过 "Event Patten" 实现来实现,它仍然只是在您的应用程序中调用该方法。
在 Spring 框架中,应用程序处理带有 Controller
的 "click" 数据包。有关 Spring 框架的文章,请参阅 Web MVC framework。关于您的问题,请特别注意有关控制器的第 13.3 节。
Controllers interpret user input and transform such input into a sensible model which will be represented to the user by the view.
我目前正在尝试使用 Spring Boot,并使用 Spring Boot 和 Thymeleaf 开发了一些类似 CRUD 的小型应用程序 - 似乎运行良好。
但是在 Spring Boot with Thymeleaf 中没有任何方法可以实现 ActionListeners 或 ClickListeners,就像您可以使用传统的 Java GUI 组件或 Vaadin 一样?
此致
Web 技术不同于桌面技术。计算机是分开的:您的网络浏览器在您的计算机上,网页在服务器上。当您单击一个按钮时,Web 浏览器会创建一个 TCP/IP "internet" 数据包并将其发送到服务器,以便 Web 应用程序可以决定如何处理它。
在 Java/AWT 桌面应用程序中,使用 ActionListeners,单击按钮最终会调用计算机上 运行 的应用程序。即使它可以通过 "Event Patten" 实现来实现,它仍然只是在您的应用程序中调用该方法。
在 Spring 框架中,应用程序处理带有 Controller
的 "click" 数据包。有关 Spring 框架的文章,请参阅 Web MVC framework。关于您的问题,请特别注意有关控制器的第 13.3 节。
Controllers interpret user input and transform such input into a sensible model which will be represented to the user by the view.