Core태그의 redirect 태그
coreTag5.jsp파일
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSTL_core_redirect</title>
</head>
<body>
<c:redirect url="http://www.google.com">
<c:param name="a" value="검색"/>
</c:redirect>
</body>
</html>
여기서 우리가 주의깊게 볼 곳은 다음이다.
이제 taglib는 익숙해서 굳이 확인 안하겠다.
c:redirect 태그는 다음과 같이 생겼다.
url주소로 돌아간다 라는 의미 --> 페이지 이동의 의미
response.sendRedirect()와 똑같은 기능
신기한 것은 param을 이용해서 넘겨줄 수도 있음
<c:redirect url="http://www.google.com">
<c:param name="a" value="검색"/>
</c:redirect>
뿐만 아니라 현재 있는 jsp 파일이 a 일 때 WebContent/b.jsp로 이동할 수도 있다.
<c:redirect url=“/b.jsp” context=“/WebContent” />