Spring Boot
jstl 사용법
BINTHEWORLD
2022. 6. 29. 19:49
jstl 사용법
https://www.tutorialspoint.com/jsp/jsp_standard_tag_library.htm
JSP - Standard Tag Library (JSTL) Tutorial
JSP - Standard Tag Library (JSTL) Tutorial In this chapter, we will understand the different tags in JSP. The JavaServer Pages Standard Tag Library (JSTL) is a collection of useful JSP tags which encapsulates the core functionality common to many JSP appli
www.tutorialspoint.com
jstl 라이브러리를 복사하여 원하는 jsp 상단에 붙여넣기
<%@ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %>
pom.xml 의존성 설정
<!-- JSTL -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
jstl문법
<c:choose>
<c:when test="${empty sessionScope.principal}">
<ul class="navbar-nav">
<li class="nav-item"><a class="nav-link" href="/loginForm">로그인</a></li>
<li class="nav-item"><a class="nav-link" href="/joinForm">회원가입</a></li>
</ul>
</c:when>
<c:otherwise>
<ul class="navbar-nav">
<li class="nav-item"><a class="nav-link" href="/board/form">글쓰기</a></li>
<li class="nav-item"><a class="nav-link" href="/user/form">회원정보</a></li>
<li class="nav-item"><a class="nav-link" href="/logout">로그아웃</a></li>
</ul>
</c:otherwise>
</c:choose>