WEB/JSP

[JSP] ch02-03. Import

밍글링글링 2017. 11. 1.
728x90

2-3. import

 

WebContent/ch02/ex03/import.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="ch02.ex03.Adder"%>
<%@ page import="java.time.LocalDate"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%
    Adder adder = new Adder();
    LocalDate date = LocalDate.now();
%>
<%= adder.add(1,2)%> <br>
<%= date%>

 

src/ch02/ex03/Addr.java

public class Adder {
    public int add(int num1, int num2){
        return num1+num2;
    }
}

 

728x90

'WEB > JSP' 카테고리의 다른 글

[JSP] ch02-05.Pameter(파라미터) 2  (0) 2017.11.02
[JSP] ch02-04. Parameter(파라미터)  (0) 2017.11.01
[JSP] ch02-02. declaration  (0) 2017.11.01
[JSP] ch02-01. scriptlet  (0) 2017.11.01
[JSP] ch01-04. LifeCycle  (0) 2017.11.01

댓글