728x90
반응형
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "class path resource [templates/quality/qualityInspectionRequestList.html]")] with root cause
org.springframework.expression.spel.SpelEvaluationException: EL1004E: Method call: Method getInspection_request_approval() cannot be found on type java.util.HashMap
오류원인
값이 null일때 컬럼 자체를 안가져오는 것


해결
이럴때 쓰는 타임리프 함수
#maps.containsKey()
해당 키 값이 있는지 확인해준다.
th:text="${#maps.containsKey(l, 'inspection_request_approval') ? l.inspection_request_approval: '' }"
함수를 쓰고 삼항연산자로 활용하면 true일 땐 값이 나오고 false일땐 공백이 나오게 해준다.
삼항연산자 사용법은 아래 링크 확인
[java] 삼항연산자 사용방법
삼항연산자에 대해 알아보자 보통 조건문은 if~else 문을 많이 사용한다. public class main { public static void main(String[] args) { int number = 1; String message = ""; if(number == 1){ message = "1입니다."; }else{ message = "다
gimdam.tistory.com
728x90
반응형