해당 VO를 list 로 받는 listVO를 만들어 준다.
해당 listVO를 @Valid 설정해준다.
입력 받을 때 ${listvo.voProperty }
이런식으로 받는다
package kr.or.anyapart.asset.vo;
import java.io.Serializable;
import java.util.List;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.hibernate.validator.constraints.NotBlank;
import kr.or.anyapart.commons.validate.groups.DeleteGroup;
import kr.or.anyapart.commons.validate.groups.InsertGroup;
import kr.or.anyapart.commons.validate.groups.UpdateGroup;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
@Data
@EqualsAndHashCode(of="prodId")
@ToString
@AllArgsConstructor
@NoArgsConstructor
public class ProdVO implements Serializable {
@NotBlank(groups={DeleteGroup.class, UpdateGroup.class})
@Size(max=60)
private String prodId; //물품 등록 번호
@Size(max=60)
private String prodCode; //물품분류코드
@NotBlank(groups={InsertGroup.class, UpdateGroup.class})
@Size(max=60)
private String prodName; //물품명
@NotNull(groups={InsertGroup.class, UpdateGroup.class})
@Min(0)
private Integer prodPrice; //물품 가격
@NotBlank(groups={InsertGroup.class, UpdateGroup.class})
@Size(max=200)
private String prodCompany; //물품 제조사
@NotNull(groups={InsertGroup.class, UpdateGroup.class})
@Min(0)
private Integer prodQty; //수량
@NotBlank(groups={InsertGroup.class, UpdateGroup.class})
@Size(max=5)
private String aptCode; //아파트코드
private List<ProdVO> prodList;
}
```java
package kr.or.anyapart.asset.vo;
import java.util.List;
import javax.validation.Valid;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class ProdListVO {
@Valid
List<ProdVO> prodList;
}
<tr>
<input type="hidden" name="prodList[0].aptCode" text="${pagingVO.searchVO.searchAptCode }"/>
<td>
<select name="prodList[0].prodCode" class="custom-select md-6 prodCode">
<option value>전체</option>
</select>
</td>
<td><input name="prodList[0].prodName" size="12" type="text"></td>
<td><input name="prodList[0].prodPrice" size="12" type="number" min="0" max="9999999999"></td>
<td><input name="prodList[0].prodCompany" size="12" type="text"></td>
<td><input name="prodList[0].prodQty" size="12" type="number" min="0" max="9999999999"></td>
<td class="last now"><span class="btn btn-primary plusBtn">+</span><span class='btn btn-danger minusBtn'>-</span></td>
</tr>