if...else 블록은 일반 Scriptlet으로 시작하지만 Scriptlet 태그 사이에 HTML 텍스트가 포함된 각 행에서 Scriptlet이 닫힙니다.
예시
<%! int day = 3; %>
<html>
<head>
<title>IF...ELSE Example</title>
</head>
<body>
<% if (day == 1 || day == 7) { %>
<p> Today is weekend</p>
<% } else { %>
<p> Today is not weekend</p>
<% } %>
</body>
</html> 위의 코드는 다음 결과를 생성합니다 -
Today is not weekend