http://homepage.divms.uiowa.edu/~slonnegr/wpj/jqr.pdf
Expressions Language (EL)
https://offbyone.tistory.com/368
<c:forEach var="변수" items="${리스트}" varStatus="변수">
</c:forEach>
//객체가 있을 경우
<c:forEach var="vo" items="${voList}" varStatus="status">
${vo.id}
</c:forEach>
//객체가 없을 경우
<c:forEach var="vo" items="${voList}" varStatus="status">
${vo}
</c:forEach>
//루프 돌면서 값 출력하는 방법
<c:forEach var="i" begin="0" end="3">
${i}
</c:forEach>
실행결과 :
0
1
2
3
//증가 단계 지정
<c:forEach var="i" begin="0" end="3" step="2">
${i}
</c:forEach>
실행결과 :
0
2
//리스트를 역으로 출력할 때
<c:set var="size" value="${fn:length(nameList)}" />
<c:forEach var="i" begin="1" end="${size}">
<p><c:out value="${nameList[size - i]}" /></p>
</c:forEach>
//varStatus 속성
<c:forEach var="name" items="${nameList}" varStatus="status">
<p>${status.count} : ${status.index} : ${status.current}</p>
</c:forEach>
실행결과 :
1 : 0 : 홍길동
2 : 1 : 김철수
3 : 2 : 박영희
- status.index : 0부터 시작하는 루프의 인덱스 입니다.
- status.count : 현재 몇번째 루프인지 값입니다. 1부터 시작합니다.
- status.current : 현재 아이템입니다. var 속성의 값과 같습니다.
- status.first : 현재가 첫번째 루프이면 참입니다.
- status.last : 현재가 마지막 루프이면 참입니다.
- status.begin : begin 속성을 사용했을 경우 그 값이 나옵니다.
- status.end : end 속성을 사용했을 경우 그 값이 나옵니다.
- status.step : step 속성을 사용했을 경우 그 값이 나옵니다.
<c:out value="${value}"/>
필수적으로 입력해야 되는 value 속성으로, 화면에 출력할 값을 적습니다. 이때 어떤 값이든 간에 출력 값을 문자열로 바꾸어 출력합니다.
here is the answer from the question "what is different between session and sessonScope".
https://stackoverflow.com/questions/17590620/are-session-and-sessionscope-the-same-in-jsp-el
'개발관련 > front-end' 카테고리의 다른 글
DOM 은 API 이다. (0) | 2022.04.22 |
---|---|
마우스 드래그 javascript (0) | 2022.04.14 |
margin auto 위아래 안될 때 (0) | 2021.11.29 |
자바스크립트 anchor 사용하는 방법 여러가지 관련 사이트 (0) | 2021.10.27 |
javaScript에 excel 파일 가져오기 및 내보내기 관련 링크 (0) | 2021.10.06 |