th:object // 커맨드 객체 지정
*{...} // 선택 변수식/ th:object 에서 선택한 객체에 접근 함
th:field // HTML 태그의 id , name , value 속성을 자동으로 처리해준다.
<input type="text" th:field="*{itemName}" />
<input type="text" id="itemName" name="itemName" th:value="*{itemName}" />
th:object 를 적용하려면 먼저 해당 오브젝트 정보를 model 객체에 담아서 html쪽으로 넘겨주어야 한다.
<form action="item.html" th:action th:object="${item}" method="post">
<div>
<label for="itemName">상품명</label>
<input type="text" id="itemName" th:field="*{itemName}" class="form-
control" placeholder="이름을 입력하세요"> </div>
<div>
<label for="price">가격</label>
<input type="text" id="price" th:field="*{price}" class="form-control" placeholder="가격을 입력하세요">
</div>
<div>
<label for="quantity">수량</label>
<input type="text" id="quantity" th:field="*{quantity}" class="form-
control" placeholder="수량을 입력하세요">
</div>
입력 폼 미쳤다