<%@ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core" %><%@ taglib prefix = "fmt" uri = "http://java.sun.com/jsp/jstl/fmt" %><%@ taglib prefix = "fn" uri = "http://java.sun.com/jsp/jstl/functions" %><%@ taglib prefix = "sql" uri = "http://java.sun.com/jsp/jstl/sql" %> to라는 변수에 10이라는 값을 넣는 것.
<c:set var = "to" value = "10"/>
too라는 변수에 {10, 20, 30, 40} 값을 넣어서 배열로 만듬.
<c:set var = "too" value = "10,20,30,40"/>
<%= to %>
=을 붙이면 된다.
<c:forEach var = "item" items = "${too}" varStatus="idx">
${idx.index}번방: ${item} <br/>
</c:forEach>
arr개수 : ${fn:length(too)}개
<c:set var = "too" value = "${fn:split(too, ',')}"> 로 , 마다 잘라서 저장해야 한다.too개수 : ${fn:length(too)}개too개수 : ${c:out value = "${too}"}개<c:if test = "${not empty too}">
<c:forEach var = "item" items = "${too}" varStatus = "status">
<h1>${status.count}번방 : ${item}</h1>
<h1>${status.count}번방 : ${status.index}번째 = ${item}</h1>
</c:forEach>
</c:if>
<c:if test = "${param.msg != null}">
msg = ${param.msg}
<br>
msg = <c:out value = "${param.msg}"/>
</c:if>
<input type = "text" value = "${param.msg}" />
<c:set var = "age" value = "${param.age}"/>
<c:choose>
<c:when test = "${age >= 19}"> 성인 </c:when>
<c:when test = "${age < 19}"> 미성년자 </c:when>
<c:otherwise> 값이 유효하지 않습니다. <c:otherwise>
</c:choose>
otherwise가 else같은거임.
<c:url />이 root context path를 자동으로 포함시키기 때문에 서버 소스를 수정하면 알아서 그 수정된 경로가 추가된다.<form action="/app/register/save" method="get"><form action="<c:url value = "/register/save" />" method="get">
document.getElementById("msg").innerHTML = `<i class="fa fa-exclamation-circle"> ${ '${msg}' }</i>`;${}를 썼지만 (es6 방식) EL방식은 서버에서 돌아가는거고, es6 방식은 브라우저에서 돌아가는데 서버가 먼저 동작하기 때문에 ${msg}라고 쓰면 이걸 서버측 EL 방식으로 인식한다. (${} 벗겨짐)${} 내부에 있는 msg만 남아있게 되어 빽틱 안에서 msg가 일반 텍스트 취급을 받게 된다.${} 한세트를 더 넣어주면 된다. => ${ ${msg} }${}도 EL로 보니까 따옴표로 감싸야 된다. -> ${ '${msg}' }<h1>id = ${param.id}</h1> => id = asdf 이렇게 출력됨. <h1>sns = ${param.sns}</h1> => 만약 sns가 여러개 일 때 이렇게만 찍으면 첫번째 sns 파라미터값만 출력된다. <h1>sns = ${paramValues.sns}</h1> => 이렇게 찍으면 주소값 출력된다. <h1>sns = ${paramValues.sns[0]}</h1> => sns = facebook 이렇게 출력된다. <% String id = request.getParameter("id"); %>
<h1>여기 : <%= id %></h1>
<% String snsArr[] = request.getParameterValues("sns"); %>
snsArr 개수 : <%= snsArr.length%> 개
String s = "한글";
s = URLEncoder.encode(s);
model.addAttribute("s", s);<%@ page import = "java.net.URLDecoder" %>${URLDecoder.decode(param.s, "utf-8")}${empty param.msg?"":msg}${not empty param.msg?msg:""}