Bean Validation - New Article

Modify as shown below.
private Integer articleNo;//Change int to Integer

@Size(min=2,max=10,message="The board code must be between 2 and 10 characters.")
private String boardCd;

@Size(min=1,max=60,message="The title must be between 1 and 100 characters.")
private String title;

@Size(min=1,message="The content must be at least two characters.")
private String content;


public Integer getArticleNo() {
  return articleNo;

public void setArticleNo(Integer articleNo) {
  this.articleNo = articleNo;
@RequestMapping(value="/write", method=RequestMethod.GET)
public String writeForm(String boardCd, Model model) {
  String boardNm = boardService.getBoardNm(boardCd);
  model.addAttribute("boardNm", boardNm);
  model.addAttribute("article", new Article());
  return "bbs/write";

@RequestMapping(value="/write", method=RequestMethod.POST)
public String write(@Valid Article article, BindingResult bindingResult,
    Model model,
    MultipartHttpServletRequest mpRequest,
    Principal principal) throws Exception {
  if (bindingResult.hasErrors()) {
    String boardNm = boardService.getBoardNm(article.getBoardCd());
    model.addAttribute("boardNm", boardNm);
    return "bbs/write";


  return "redirect:/bbs/list?page=1&boardCd=" + article.getBoardCd();
<%@ taglib uri="" prefix="sf" %>

<sf:form id="writeForm" action="write" method="post" enctype="multipart/form-data" 
    modelAttribute="article" onsubmit="return check();">
<input type="hidden" name="articleNo" value="${param.articleNo }" />
<input type="hidden" name="boardCd" value="${param.boardCd }" />
<input type="hidden" name="page" value="${ }" />
<input type="hidden" name="searchWord" value="${param.searchWord }" />
<sf:errors path="*" cssClass="error" />
<table id="write-form">
    <sf:input path="title" style="width: 90%" /><br />
    <sf:errors path="title" cssClass="error" />
  <td colspan="2">
    <sf:textarea path="content" rows="17" cols="50" /><br />
    <sf:errors path="content" cssClass="error" />
  <td>Attach File</td>
  <td><input type="file" name="attachFile" /></td>
<div style="text-align: center; padding-bottom: 15px;">
  <input type="submit" value="Submit" />
  <input type="button" value="List" onclick="goList()" />
  <c:if test="${not empty param.articleNo }">
    <input type="button" value="Detailed view" onclick="goView()" />


On the new post screen, click the Submit button without typing anything.

New article test 1

New article test 2