본문 바로가기
Spring

[Spring] JSTL <c:if></c:if> 사용법

by 2do0 2022. 4. 20.
반응형

[Spring] JSTL <c:if></c:if> 사용법

// Controller
@RequestMapping("/cif")
public String cif(Model model) { 
    model.addAttribute("name", "park");
        
    return "/test.jsp";
}

 

// jsp
<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
// 젤위에 추가
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<html>
    <body>
    	<c:if test="${name eq 'park'}"> 
            name이 park일 때만 보임
        </c:if>
    </body>
</html>
반응형

댓글