Java Thymeleaf:张贴或放入<;表格>;th:取决于条件的操作

Java Thymeleaf:张贴或放入<;表格>;th:取决于条件的操作,java,thymeleaf,Java,Thymeleaf,根据th:if,是否可以在from th:action中指定POST或PUT方法 比如: Thymeleaf具有条件运算符 condition ? first_expression : second_expression; 您可以将此运算符用于以下目的: <form th:action="@{~/firms/save}" th:method="${firm.firmId} != null ? PUT : POST" modelAttribute="firm" th:object="$

根据
th:if
,是否可以在
from th:action
中指定
POST
PUT
方法

比如:


Thymeleaf具有条件运算符

condition ? first_expression : second_expression;
您可以将此运算符用于以下目的:

<form  th:action="@{~/firms/save}" th:method="${firm.firmId} != null ? PUT : POST" modelAttribute="firm" th:object="${firm}">

Thymeleaf具有条件运算符

condition ? first_expression : second_expression;
您可以将此运算符用于以下目的:

<form  th:action="@{~/firms/save}" th:method="${firm.firmId} != null ? PUT : POST" modelAttribute="firm" th:object="${firm}">