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() {}

How do I populate a drop down with a list using thymeleaf and spring

This is how I populate the drop down list.I think it may help to you get some idea about it. Controller List<Operator> operators = operatorService.getAllOperaors() model.addAttribute(“operators”, operators); Model @Entity @Table(name = “operator”) public class Operator { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = “id”) @JsonIgnore private Long id; @NotBlank(message=”operator Name cannot be empty”) @Column(name = “operator_name”, … Read more

Thymeleaf construct URL with variable

As user482745 suggests in the comments (now deleted), the string concatenation I previously suggested <form th:action=”@{/mycontroller/} + ${type}”> will fail in some web contexts. Thymeleaf uses LinkExpression that resolves the @{..} expression. Internally, this uses HttpServletResponse#encodeURL(String). Its javadoc states For robust session tracking, all URLs emitted by a servlet should be run through this method. … Read more