Skip to content

[오류] 테이블에 값이 없는 초기일때, 발생하는 문제. 해당 타임리프 부분, null의 값에 ?를 붙여줘야하네요. #6

Description

@infott2t

처음 jar파일을 올릴 때, DB에 데이터가 없죠. 이럴 경우, null값이 타임리프에 들어가서 오류가 발생하는 군요.

 <p class="card-text" th:utext="${board.content}"></p>
<span class="badge bg-light text-dark" th:text="${board.categoryStr?.name}"></span>
</a>
</div>
</div>
</div>
</div>
</div>

엔티티 board가 categoryStr을 참조하는데, jar파일을 올리기만해서, 데이터가 없습니다. 이럴경우, 위에 처럼, ${board.categoryStr?.name} 처럼, ?를 붙여주시면 됨니다. 위의 경우는 Board 엔티티와 CategoryStr이라는 엔티티가 참조하는 경우, 위처럼 해줘야합니다. 참조하는 경우.

감사합니다.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions