| Servlet Spec | JSP Spec | EL Spec | Tomcat Version |
|---|---|---|---|
| 3.1 | 2.3 | 3.0 | 8.0 |
| 3.0 | 2.2 | 2.2 | 7.0 |
// 일반 데이터
String data = "데이터";
// 속성 데이터
pageContext.setAttribute("data", "페이지 데이터");
request.setAttribute("data", "요청데이터");
session.setAttribute("data", "세션 데이터");
application.setAttribute("data", "어플리케이션 데이터");
${data}${pageScope.data}${requestScope.data}${sessionScope.data}${applicationScope.data}pageContext.setAttribute("data", null); : null이면 truepageContext.setAttribute("data", ""); : true${1+1 } : 2${1+"1" } : 2${"1"+"1"} : 2${4/2 } : 2.0${3/2 } : 1.5${true and true }, ${true or false }, ${not false }${ab and bc }, ${ab or bc} : 존재하지 않아서 false${true and bc}, ${true or bc}, ${not abc}${abc + 1} : 1 - abc가 없어서 0 으로 바뀜${abc - bcd} : 0${empty abc ? "없음" : "있음"}${not empty abc ? "있음" : "없음"}String[] array = new String[]{"value1", "value2"};
pageContext.setAttribute("array", array);
<%=array[3] %> : IndexOutOfBoundException ${array[3] } : 화이트스페이스List<String> list = new ArrayList<>();
list.add("value1");
list.add("value2");
pageContext.setAttribute("list", list);
<%=list.get(3) %> : IndexOutOfBoundException${list.get(3) } : el2.0에는 메소드 호출 불가능${list[3] } : array처럼 접근Set set = new HashSet();
set.add("value1");
set.add("value2");
pageContext.setAttribute("set", set);
<%=set %>, ${set }Map map = new HashMap();
map.put("key-1", "value1");
map.put("key2", "value2");
pageContext.setAttribute("map", map);
<%=map.get("key-1") %>, ${map.get("key-1") }, ${map["key-1"]}${map.key-1 } : 산술연산자로 인식하여 연산 후 -1로 출력됨<%=member.getMem_id() %>${member.getMem_id() }${member.mem_id }${member["mem_id"] }<%=(new CookieUtils(request)).getCookie("JSESSIONID").getValue() %>${cookie.JSESSIONID.value }${cookie["JESSIONID"]["value"] }<c:set var="test" value="테스트" scope="page" /><c:remove var="test" scope="page"/>${empty test ? "지워졌음" : test }<c:if test="${empty test }">
"지워졌음"
</c:if>
<c:if test="${not empty test }">
${test }
</c:if>
<c:choose>
<c:when test="${empty test }">
"지워졌음"
</c:when>
<c:otherwise>
${test }
</c:otherwise>
</c:choose>
<c:forTokens items="1,2,3" delims="," var="num" varStatus="vs">
${num * 3 } ${not vs.last ? ", " : ""}
</c:forTokens>
<c:url value="/11/jstlDesc.jsp" var="clientURL"/>
<a href="${clientURL } ">세션유지하기</a>
세션 아이디 : ${pageContext.session.id }
<a href="/webStudy03_MVCFramework/11/jstlDesc.jsp ">세션유지하기</a><c:url value="/prod/prodView.do" var="viewURL">
<c:param name="prod_id" value="P101000001"/>
</c:url>
<a href="${viewURL} ">상품상세조회</a>
<a href="/webStudy03_MVCFramework/prod/prodView.do?prod_id=P101000001 ">상품상세조회</a>-<c:redirect url="/"/>
<c:import url="https://www.daum.net" var="daum"/><c:out value="${daum }" escapeXml="false"></c:out><fmt:setLocale value="<%=Locale.ENGLISH %>"/><fmt:bundle basename="kr.or.ddit.msg.message"><fmt:message key="bow" /></fmt:bundle> : 번들을 블럭처럼 지정할 수 있음<c:set var="array" value='<%=new String[]{"value1", "value2"} %>'/>package kr.or.ddit.taglibs;
import java.util.Calendar;
public class CalendarGenerator {
public static Calendar generate() {
return Calendar.getInstance();
}
}

<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd" <!--중요-->
version="2.0">
<function>
<description>
Tests if an input string contains the specified substring.
</description>
<name>contains</name>
<function-class>org.apache.taglibs.standard.functions.Functions</function-class>
<function-signature>boolean contains(java.lang.String, java.lang.String)</function-signature>
<example>
<c:if test="${fn:contains(name, searchString)}">
</example>
</function>
오늘두 잘보구갑니당!👀👍❤