본문 바로가기
What I Learned/JSP

JSP Life Cycle

by 단풍국범생이 2019. 8. 7.
<%@ page language="java" contentType="text/html; charset=EUC-KR"
    pageEncoding="EUC-KR"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
</head>
<body>
Hello~!!!
<%
	System.out.print("jspService()");
%>

<%! 
	public void jspInit(){
	System.out.print("jspInit()");
}
%>
<%! 
	public void jspDestroy(){
	System.out.print("jspDestroy()");
}
%>
</body>
</html>

 

With the code above, you can test how JSP life cycle works.

First, check on Java file that has created after you create JSP file.

Location: ...workplace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\work\Catalina\localhost\firstWeb\org\apache\jsp

 

public void jspInit(){
	System.out.print("jspInit()");
}

 
	public void jspDestroy(){
	System.out.print("jspDestroy()");
}

Just like servlet, there is jspInit, jspDestory, and jspService.

 

'What I Learned > JSP' 카테고리의 다른 글

What is JSP(Java Server Page)?  (0) 2019.08.06