비 연결성인 웹에서 관계유지를 하기 위해 사용되는 클래스(내장객체아님)
접속자의 HDD에 file이 생성되고, 문자열로만 정보가 저장된다.
최장 1년까지 유지된다.
웹 브라우저에서 확인가능하고, 수정, 삭제도 가능.
사용법)
1. 객체화
Cookie c = new Cookie("이름","값");
쿠키 심기.
response.addCookie(쿠키 객체);
쿠키 읽기
Cookie[] cookies = request.getCookies();
for(Cookie tempCookie : cookies){
5. 쿠키의 이름 얻기
String name = tempCookie.getName();
6. 쿠키의 값 얻기
String value=tempCookie.getValue();
}

태그가 자체가 정해진 일을 수행하는 태그.
사용법)
<jsp:태그명 속성="값" 속성="값",,,></jsp:태그명>
<jsp:useBean>, <jsp:setProperty>, <jsp:getProperty>, <jsp:include>, <jsp:forward>,<jsp:param>,,,
사용법)
<jsp:include page="끼워넣을 JSP URI"/>
VO class를 객체화하여 사용할 때.
객체화 + scope객체를 함께 사용.
(scope : 값을 저장하고 사용하는 범위를 제공하는 객체.)
사용법)
객체화) default constructor만 사용가능.
<jsp:useBean id="객체명" class="패키지명.클래스명" scope="객체화 후 객체사용 범위"/>
(생략하면 page가 기본. scope객체는 page , request, session, application 4가지를 제공)
값 할당) setter method 호출
<jsp:setProperty name="객체명" property="set을 제외한 method명 소문자" value="값"/>
값 사용) getter method 호출 : 웹 브라우저의 출력까지 함께 수행
<jsp:getProperty name="객체명" property="get을 제외한 method명 소문자"/>
사용법
public class TestVO{
private String name;
private int myAge;
public TestVO(){
}
public TestVO(String name, int age){
}
public void setName(String name){
this.name=name;
}
public String getName(){
return name;
}
public void setMyAge(int myAge){
this.myAge = myAge;
}
public String getMyAge(){
return myAge;
}
}
=============javascript===============================================
<%
TestVO tVO=new TestVO();
pageContext.setAttbute(“obj”, tVO );
tVO.setName(“윤웅찬”);
tVO.setAge(20);
%>
-객체화( TestVO() )
<jsp:useBean id=“tVO” class=“day0425.TestVO” scope=“page”/>
-setter method 호출
<jsp:setProperty name=“tVO” property=“name” value=“윤웅찬”/>
<jsp:setProperty name=“tVO” property=“myAge” value=“20”/>
-getter method 호출 : getter method의 반환값을 web browser에 출력 해준다.
(변수에 할당될 수 없다.)
<jsp:getProperty name=“tVO” property=“name”/>
<jsp:getProperty name=“tVO” property=“myAge”/>
=====================================================================