Spring FormクラスをHTMLで表現するときの方法

Spring Formで以下の定義を作成したとします。

@Data
public class RegistForm {
	private String userId;
	private Integer rating;
	private String comment;
}

この定義をHTML で表示させる場合は以下のように使うことができます。

<p th:text="${registForm.userId}"></p>
<p th:text="${registForm.rating}"></p>
<p th:text="${registForm.comment}"></p>

もしくは div 定義に th:object で定義することで、*{ プロパティ名 } の形式で利用することが可能になります。

<div th:object="${registForm}">
	<p th:text="*{userId}"></p>
	<p th:text="*{rating}"></p>
	<p th:text="*{comment}"></p>
</div>