Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- 자바 swing 프로젝트
- dbeaver 백업/복구
- 되돌리기
- 클래스 참조
- 깃허브 토큰 생성
- vue 추가
- AWS 생성
- 환경변수
- Quartz dependency
- Quartz 라이브러리
- git 폴더 모으기
- document 함수
- firstChild
- .ppk
- EL1021E
- deploy.sh
- vue 실행
- submit 기본동작
- 타임리프 참조 오류
- reset
- Jenkins
- Node Property
- 채팅 프로젝트
- CI/CD
- 배포 자동화
- 테스팅
- ..gitignore
- 깃허브 토큰 발급
- 소프트웨어
- 배열 call by value
Archives
- Today
- Total
TY blog
JSTL 태그 사용 본문
1. 상단에 JSTL 사용을 위한 태그 작성
/*상단에 JSTL 사용을 위한 태그 작성*/
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
2. List Foreach 배열 사용방법
<c:forEach var="list" items="${list}" varStatus="status">
<tr onclick="devDetail()">
<td class="shortCell">${status.count }</td>
<td class="titleCell">${list.PROJECTNAME }</td>
<c:choose>
<c:when test="${list.PROJECTCATEGORY == 'project'}">
<td class="Cell">개인 프로젝트</td>
</c:when>
<c:when test="${list.PROJECTCATEGORY == 'assignment'}">
<td class="Cell">대학교 과제</td>
</c:when>
<c:otherwise>
<td class="Cell">알고리즘</td>
</c:otherwise>
</c:choose>
<c:choose>
<c:when test="${list.PROJECTSTATUS == 'succ'}">
<td class="Cell"><span class="ing">개발완료</span></td>
</c:when>
<c:otherwise>
<td class="Cell"><span class="ing">진행중</span></td>
</c:otherwise>
</c:choose>
<td class="Cell">${list.PROJECTDATE == ' ' ? '-' : list.PROJECTDATE}</td>
</tr>
</c:forEach>
2-1. c:forEach var="list" items="${list}" varStatus="status"
- controller에서 받은 list 객체를 var="list"로 내부에 사용할 변수를 할당해 사용한다.
- varStatus="status" 로 상태변수 할당해 ${status.count} 변수를 사용
- ${status.count} : 1부터 시작해 리스트에 숫자를 매겨준다
2-2. <c:choose>
- <c:when> / <c:otherwise> 와 같이 사용하며 조건식에서 사용가능 ( c:if 문은 단독으로 사용가능 )
2-3. ${ }
- ${ } 태그 내에서도 삼항연산자 사용가능
3. fn 함수사용
/* 상단 태그 삽입 */
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
3-1. fn:trim() : 문자열 공백제거
3-2. fn:length() : 문자열 길이구하는 함수
'기타' 카테고리의 다른 글
프로세스와 쓰레드 (0) | 2024.02.17 |
---|---|
웹 쿠키 속성 (0) | 2023.08.27 |
같은IP 에서 톰캣 2개이상 동시 로그인시에 세션끊김현상 조치 - JSESSIONID (0) | 2023.03.28 |
Oracle SQL (0) | 2023.02.12 |
이클립스 웹 프로젝트 초기 세팅 (0) | 2023.01.02 |
Comments