전화번호, 사무실번호, 팩스번호를 기존에 input text 한 칸 이던 것을

dash(-) 기준으로 세 칸으로 나눠서 입력받아 달라는 요구사항이 들어왔다.

 

프런트 단 템플릿 엔진은 타임리프.... 경험이 거의 전무하다..

 

각각 번호는 이렇게 들어가 있다.

 

  1. 전화번호가 있으면 '-' 기준으로 input 칸이 세 칸으로 나뉘어야 한다.
  2. 공백인 데이터 or null 값인 데이터라면 공란의 세칸이 보여야 한다.

 

타임리프 생 초짜가 창피하지만 코딩한 결과는 이렇다.

 

* 사무실 전화번호 기준

<th scope="row">사무실전화번호</th>
	<td th:if="${not #strings.isEmpty(user.office_phone)} ">
		<input id="office_phone" style="display:none;" type="text" th:field="*{office_phone}" title="사무실 전화번호를 입력해주세요"/>
		<input id = "office_phone1" style="width:30%" type="text" th:value="${#strings.arraySplit(user.office_phone,'-')[0]}" /> -
		<input id = "office_phone2" style="width:30%" type="text" th:value="${#strings.arraySplit(user.office_phone,'-')[1]}" /> -
		<input id = "office_phone3" style="width:30%" type="text" th:value="${#strings.arraySplit(user.office_phone,'-')[2]}" />
	</td>
	<td th:if="${user.office_phone == null or #strings.isEmpty(user.office_phone)}">
		<input style="display:none;" type="text" th:field="*{office_phone}" title="사무실 전화번호를 입력해주세요" />
		<input id = "office_phone1" style="width:30%" type="text" /> -
		<input id = "office_phone2" style="width:30%" type="text" /> -
		<input id = "office_phone3" style="width:30%" type="text" />
	</td>
 

 

* 결과

 

 

 

* 어려웠던 부분

1. 타임리프 null 체크 구문이 쉬우면서도 어려웠다....

<td th:if="${not #strings.isEmpty(user.office_phone)} ">
<td>

<td th:if="${logodiTeacher.office_phone == null or #strings.isEmpty(user.office_phone)}">
</td>
 

 

 

':D > 공부해야할 것' 카테고리의 다른 글

tomcat  (0) 2018.03.21
maven 이용한 프로젝트 관리 방법  (0) 2018.03.21
다중 스레드  (0) 2015.01.10
Migration(마이그레이션)  (0) 2014.12.22
Posted by 긍뎡
,

잘 쓰고 있던 로컬 서버용 사이트가 메인 페이지 진입 시 500 에러가 발생했다.

로그를 보니

The absolute uri: http://egovframework.gov/ctl/ui cannot be resolved in either web.xml or the jar files deployed with this application

검색해보니 이런 케이스가 종종 있었던 것 같다.

https://egovframe.go.kr/home/qainfo/qainfoRead.do?menuNo=69&qaId=QA_00000000000017254

위 에러는 egovframework.rte.ptl.mvc-3.8.0.jar 파일을 repository 에서 제대로 받아오지 못하는 것 같다.

(방화벽 문제..?)

그렇다기엔 .m2 디렉토리에 해당 jar 가 있다..

어찌됐든 개발 테스트는 계속해야 하니

해당 jar 파일을 톰캣 설치 디렉토리/lib 폴더에 직접 넣어줬다.

하나를 해결하고 나니 계속해서 비슷한 에러 발생

The absolute uri: http://www.springframework.org/tags/form cannot be resolved in either web.xml or the jar files deployed with this application

이 에러는

이 jar를,

The absolute uri: http://www.springmodules.org/tags/commons-validator cannot be resolved in either web.xml or the jar files deployed with this application

얘는

얘를 톰캣 디렉토리/lib에 설치함으로써 정상적으로 로컬 테스트가 가능해졌다....

Posted by 긍뎡
,

방콕

2024. 1. 8. 15:49

보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.