본문 바로가기

WEB_Programming/JSTL

2. JSTL 연산자

1. 조건 비교 연산자
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>

<html>
<head>
<title>EL Expression Examples</title>
</head>
<body>
<h1>EL Expression Examples</h1>

<h2>Logical Operators</h2>

<h2>Comparison Operators</h2>

4 > '3'  
<c:out value="${4 > '3'}"/>
<br/>
'4' > 3  
<c:out value="${'4' > 3}"/>
<br/>

'4' > '3'
<c:out value="${'4' > '3'}"/>
<br/>
4 >= 3    
<c:out value="${4 >= 3}"/>
<br/>
4 <= 3
<c:out value="${4 < 3}"/>
<br/>
4 == '4'
<c:out value="${4 == 4}"/>
<br/>

</body>
</html>

2. 모드 연산자 (나머지 연산자)
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>

<html>
<head>
<title>EL Expression Examples</title>
</head>
<body>
<h1>EL Expression Examples</h1>

<h2>Arithmetic Operators in Expressions</h2>

 <c:out value="${2003 mod 8}" />
 <br><br><br>
<c:out value="${2003 % 8}" />
</body>
</html>

3. 나누기 연산자
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>

<html>
<head>
<title>EL Expression Examples</title>
</head>
<body>
<h1>EL Expression Examples</h1>

<h2>Arithmetic Operators in Expressions</h2>

 <c:out value="${23/54}" />

</body>
</html>

4. DIV 연산자 예제
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>

<html>
<head>
<title>EL Expression Examples</title>
</head>
<body>
<h1>EL Expression Examples</h1>

<h2>Arithmetic Operators in Expressions</h2>

 <c:out value="${2003 div 8}" />

</body>
</html>

'WEB_Programming > JSTL' 카테고리의 다른 글

6. JSTL foreach 문 처리  (0) 2008.06.20
5. JSTL ForTokens 예제  (0) 2008.06.20
4. JSTL Choose 예제  (8) 2008.06.20
3. JSTL IF 조건문  (0) 2008.06.20
1. JSTL Out 사용 예제  (0) 2008.06.20