Using both Thymeleaf and JSP

According to this post on the Thymeleaf forum, you have two solutions. First solution : Remove the suffix property in your bean declaration (<property name=”suffix” value=”.html” /> and <property name=”suffix” value=”.jsp” />) and pass the suffix in the return value of your controllers, e.g. : @RequestMapping(“/view1”) public String thymeleafView(){ return “mythymeleafview.html”; } @RequestMapping(“/view2”) public String … Read more

Thymeleaf multiple submit button in one form

You can create separate methods with different @RequestMappings using the params variable. @RequestMapping(value=”/edit”, method=RequestMethod.POST, params=”action=save”) public ModelAndView save() {} @RequestMapping(value=”/edit”, method=RequestMethod.POST, params=”action=cancel”) public ModelAndView cancel() {}

Thymeleaf + CSS+SpringBoot

Move your template folder right under resources: src/main/resource/static/css (for CSS files); src/main/resource/templates (for HTML templates). Then correct the link tag as follows: <link href=”https://stackoverflow.com/questions/41586841/static/css/Layout.css” th:href=”@{/css/Layout.css}” rel=”stylesheet” />

Inserting an image from local directory in thymeleaf spring framework (with maven)

I want you to look into the Thymeleaf’s documentation of Standard URL Syntax and specifically the context-relative and server-relative url patterns. Context-relative URL: If you want to link resources inside your webapp then you should use context relative urls. These are URLs which are supposed to be relative to the web application root once it … Read more

Thymeleaf – How to add checked attribute to input conditionally

According to the official thymeleaf documentation http://www.thymeleaf.org/doc/tutorials/2.1/usingthymeleaf.html#fixed-value-boolean-attributes th:checked is considered as a fixed-value Boolean attribute. <input type=”checkbox” name=”active” th:checked=”${user.active}” /> Where user.active should be a boolean. So in your case it should be as Andrea mentioned, <input type=”checkbox” name=”mycheckbox” th:checked=”${flag}” />