Listener를 작성해 웹앱이 시작할 때나 종료할 때에 기능을 넣을 수 있다.
page, include, taglib 할 때만 사용한다.
일반적인 주석 구문
변수(초기화 포함)나 메소드 선언(실행부 포함)이 올 수 있다.
페이지로 값을 뿌려주는 역할을 한다.
선언, 표현식 등 모든 구문이 들어갈 수 있다.
코드
<%@ page import="jsp_sample.shape.Circle"%> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html lang="ko"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Insert title here</title> </head> <body> <% Circle circle = new Circle(20); %> <%=circle.getArea()%> </body> </html>
실행 결과