jstl-1.2.jar
라이브러리 추가.
core fmk function
<body>
<h1>EL TEST</h1>
Select fruit : ${SelectFruit}
<h1>EL TEST</h1>
fruitVO : ${fv.name}
<h1>JSTL forEach TEST(Select Box)</h1>
<select id="fruitId" name="fruitName">
<c:forEach var="fruit" items="${fruitList }">
과일목록 : <option value="${fruit }" ${fruit==SelectFruit?'selected':'' }>${fruit}</option>
</c:forEach>
</select>
심어진 값(list)를item에 넣어주면 된다.
향상된 for문을 참고하자.
</body>
삼항연산도 가능하다.
${fruit==SelectFruit?'selected':'' }
----------------if 문--------------
<h1>JSTL IF TEST(Select Box)</h1>
<c:if test="${count >0 }">
<select id="fruitId" name="fruitName">
<c:forEach var="fruit" items="${fruitList }">
과일목록 : <option value="${fruit }" ${fruit==SelectFruit?'selected':'' }>${fruit}</option>
</c:forEach>
</select>
</c:if>
test는 항상 test를 써줘야 한다. 속성명이기 때문에.
'WebStudy' 카테고리의 다른 글
JSTL forEach, FroToken 속성 (0) | 2015.06.26 |
---|---|
cookie (0) | 2015.06.23 |
DB싱글톤 방식, ConnectionPool (0) | 2015.06.23 |
session 에 관한 ... (0) | 2015.06.22 |
jqeury servelt ajax (0) | 2015.06.22 |