DB(baek)

2021-11-19 sql01~05 + JDBCServlet

Hesitater 2021. 11. 19. 18:43
728x90

2021-11-19

 

sql

01intro.sql

02select01.sql

02select02-distinct.sql

03select-where.sql

04and-or-not.sql

05orderBy

JDBC01Servlet.java

JDBC02Servlet.java

JDBCListener1

v01.jsp

v011.jsp

 

 

Structured Query Language (SQL)

 

SCHEMAS
table(행과열을 가지고 있는)을 가지고 있는 DB

test 안의 Tables 가있다
데이터를 읽는법 부터 
선생님 파일은 선생님 프로젝트 WEB-INF안의 sql 폴더안에 작성해줌


SCHEMA 에서 파일들 눌러보면 

 

 

 

★01intro

 

-- Structured Query Language (SQL)

-- 한줄 주석
-- 하나의 명령문은 세미콜론으로 끝남
-- 하나의 명령문을 실행하는 방법
-- 커서를 명령문안 (또는 맨끝) 에 두고 ctrl +enter


-- sql은 대소문자 구분을 안함 (단, 벤더나 버전에 따라 다를 수 있음)
select NOW();

-- sql은 작성 관습 : 키워드는 대문자로 작성

 

 

01intro

-- Structured Query Language (SQL)

-- 한줄 주석
-- 하나의 명령문은 세미콜론으로 끝남
-- 하나의 명령문을 실행하는 방법
-- 커서를 명령문안 (또는 맨끝) 에 두고 ctrl +enter
USE test;

SELECT now();

-- sql은 대소문자 구분을 안함 (단, 벤더나 버전에 따라 다를 수 있음)
select NOW();

-- sql은 작성 관습 : 키워드는 대문자로 작성
SELECT now();

SELECT * FROM Categories;
SELECT * FROM Customers;
SELECT * FROM Employees;
SELECT * FROM OrderDetails;
SELECT * FROM Orders;
SELECT * FROM Products;
SELECT * FROM Shippers;
SELECT * FROM Suppliers

 

 

○결과값

여러개 중 SELECT * FROM Customers; 커서 놓고 Ctrl + enter 한 결과

 

 

 

★02select01

 

SELECT 키워드

 -- A 테이블의 내용을 읽을 때
 -- SELECT 와 FROM 조합으로 작성
 -- SELECT : 조회찰 열 (columns) 명시
 -- FROM : Table 명 작성

 

 

 

 

 

02select01

 -- A 테이블의 내용을 읽을 때
 -- SELECT 와 FROM 조합으로 작성
 -- SELECT : 조회찰 열 (columns) 명시
 -- FROM : Table 명 작성
 
 SELECT * FROM Customers; -- Cusotmers 테이블 조회
 
 -- Employees 테이블 조회
 SELECT * FROM Employees;
 
 -- 조회할 열 선택
 SELECT LastName, FirstName FROM Employees;
 
 -- Customers 테이블의 CustomerName, Country Column만 조회
 SELECT CustomerName, Country FROM Customers;
 
 SELECT customername, country FROM Customers;
 
 -- 모든 컬럼 조회 : *
 SELECT * FROM Customers;
 
 
 -- 테이블 컬럼(and 제약사항) 조회
 DESCRIBE Customers;
 DESC Customers;
 
 DESC Employees;
 
 -- Categories 테이블의 컬럼을 조회
 DESCRIBE Categories;
 DESC Categories;

 

 

○결과값

여러개의 결과물 눈으로 확인

 

-- Cusotmers 테이블 조회

SELECT * FROM Customers;

 

 

 

-- Employees 테이블 조회
 SELECT * FROM Employees;

 

 -- 조회할 열 선택
 SELECT LastName, FirstName FROM Employees;

 

-- Customers 테이블의 CustomerName, Country Column만 조회
 SELECT CustomerName, Country FROM Customers;

 

 

 -- 테이블 컬럼(and 제약사항) 조회 ( 2개가 같은 결과값 나옴)
 DESCRIBE Customers;
 DESC Customers;

 

 

★02select02 -distinct

 

02select02 -distinct

-- DISTINCT 키워드
-- : 중복 제거

 

 

02select02 -distinct

-- DISTINCT 키워드
-- : 중복 제거

SELECT City FROM Customers;

SELECT DISTINCT City FROM Customers;

SELECT * FROM Customers;
-- Customers 테이블의 Country 컬럼을 중복 제거해서 조회

SELECT Country FROM Customers;

SELECT DISTINCT Country FROM Customers;

-- 여러 컬럼 나열 가능
SELECT DISTINCT City, Country FROM Customers;

 

 

 

 

○결과값

SELECT City FROM Customers; (42)  // Customers 테이블의 City 행 모두다   91줄 나오고

SELECT DISTINCT City FROM Customers; (43)  // Customers테이블의 City행인데 중복된값 제외 69줄 나옴

 

 

 

 

 

 

 

 

★03select-where

 

 

행을 거르는 방법

ex) Brazil 만 찾고싶다


-- WHERE : 조건에 해당하는 행(row, record))만 필터

SELECT * FROM Customers WHERE Country = 'Brazil'; -- sql에서 문자열 작은 따옴표 사용



-- Customers 테이블에서 Country가 France인 행만 조회

SELECT * FROM Customers WHERE Country = 'France';
SELECT * FROM Customers WHERE Country = 'france'; -- 대소문자 구분 안함
SELECT CustomerName, Address, City FROM Customers WhERE Country = 'France';

 

 

https://www.w3schools.com/sql/sql_where.asp

 

SQL WHERE Clause

W3Schools offers free online tutorials, references and exercises in all the major languages of the web. Covering popular subjects like HTML, CSS, JavaScript, Python, SQL, Java, and many, many more.

www.w3schools.com

 

= , >  , < ,  >=,  <=  , < > , BETWEEN, LIKE, IN

 

03select-where

SELECT * FROM Customers;

-- WHERE : 조건에 해당하는 행(row, record))만 필터

SELECT * FROM Customers WHERE Country = 'Brazil'; -- sql에서 문자열 작은 따옴표 사용

-- Customers 테이블에서 Country가 France인 행만 조회

SELECT * FROM Customers WHERE Country = 'France';
SELECT * FROM Customers WHERE Country = 'france';  -- 대소문자 구분 안함
SELECT CustomerName, Address, City FROM Customers WhERE Country = 'France';

-- where에서 사용할 수 있는 연산자들
SELECT * FROM Customers WHERE CustomerID > 50;
SELECT * FROM Customers WHERE CustomerID < 5;

SELECT * FROM Customers WHERE CustomerID >= 89;
SELECT * FROM Customers WHERE CustomerID <= 5;

SELECT * FROM Customers WHERE CustomerID <> 1;   -- 같지 않다
SELECT * FROM Customers WHERE CustomerID != 1;   -- 같지 않다

SELECT * FROM Customers WHERE ContactName > 'e';
SELECT * FROM Customers WHERE ContactName <= 'c';

-- Employees 테이블의 EmployeeID를 사용해서 위 연산자 연습
SELECT * FROm Employees WHERE EmployeeID <= 2;
SELECT * FROM Employees WHERE EmployeeID > 5;
 
SELECT * FROM Employees WHERE EmployeeID <> 1;
SELECT * FROM Employees WHERE EmployeeID BETWEEN 2 and 5;

SELECT * FROM Customers WHERE City IN ('Paris','London');

-- 비교 연산 사용시 주의
SELECT * FROM Customers WHERE CustomerID = 1;    -- number와 string 연산시 형변환 일어남 (stirng -> number)
SELECT * FROM Customers WHERE CustomerID = '1';

SELECT * FROM Customers WHERE CustomerID <= '3';

SELECT * FROM Customers WHERE Country >= 'Mexico';  -- 사전순 (캐릭터 코드) 비교
SELECT * FROM Customers WHERE Country < 'Mexico';

SELECT * FROM Customers WHERE Country >= 'mexico';  -- 대소문자 구분 안함

 

 

 

○결과값

 

 

 

 

 

 

 

★04and-or-not


키워드
SQL And, Or, Not

-- AND : 두 조건 모두 만족
SELECT * FROM Customers WHERE CustomerID < 10 AND Country = 'Mexico';


-- OR : 두 조건 중 하나만 만족
SELECT * FROM Customers WHERE Country = 'Germany' OR  Country = 'Spain';

-- NOT : 조건에 해당하지 않는 것
SELECT * FROM Customers WHERE NOT Country ='UK';   -- Country != 'UK' 도 가능

 

 

04and-or-not

 

SELECT * FROM Customers WHERE CustomerID < 10;

SELECT * FROM Customers WHERE Country = 'Mexico';

-- AND : 두 조건 모두 만족
SELECT * FROM Customers WHERE CustomerID < 10 AND Country = 'Mexico';

-- Customers 테이블에서 Country 가 Germany 이고 City가 Berlin 인 행 조회
SELECT * FROM Customers WHERE Country = 'Germany';
SELECT * FROM Customers WHERE City = 'Berlin';

SELECT * FROM Customers WHERE Country = 'Germany' AND City = 'Berlin';

-- Customers 테이블에서 Country 가 Germany 이고 City가 Berlin 인 행의 CustomerName 조회
SELECT CustomerName FROM Customers WHERE Country= 'Germany' AND City = 'Berlin';

-- OR : 두 조건 중 하나만 만족
SELECT * FROM Customers WHERE City ='Paris' OR Country = 'UK';

-- Customers 테이블에서 Country Germany 이거나 Country 가 Spain 인 행 조회
SELECT * FROM Customers WHERE Country = 'Germany' OR  Country = 'Spain';

-- NOT : 조건에 해당하지 않는 것
SELECT * FROM Customers WHERE NOT Country ='UK';   -- Country != 'UK' 도 가능

-- Customers 테이블에서 Country가 Germany 가 아닌 행 조회 (NOT 키워드 사용)
SELECT * FROM Customers WHERE NOT Country = 'Germany';

-- Customers 테이블에서 Country가 Germany이고 City가 Berlin 이거나 Country가 Germany이고 City가 München인것
SELECT * FROM Customers WHERE Country='Germany' AND (City='Berlin' OR City='München');

-- 나라는 독일이고 도시는 베를린이나 뮌헨이 아닌 행 조회
-- Customers 테이블에서 Country가 Germany이고 City가 Berlin 이거나 München가 아닌것
SELECT * FROM Customers WHERE Country='Germany' AND NOT (City='Berlin' OR City='München');
SELECT * FROM Customers WHERE Country='Germany' AND (City!='Berlin' OR City !='München');

-- Customers 테이블에서 Country 가 Germany가 아니고 Country가 USA가 아닌것
SELECT * FROM Customers WHERE NOT Country='Germany' AND NOT Country='USA';

-- Customers 테이블에서 Country 가 Germany 이거나 USA 인것
SELECT * FROM Customers WHERE Country = 'Germany' OR Country='USA';
SELECT * FROM Customers WHERE NOT Country!='Germany' OR NOT Country!='USA';



SELECT COUNT(DISTINCT Country) FROM Customers;

 

 

 

 

 

 

○결과값

 

 

 

 

 

 

★05orderBy

 

ORDER BY
SELECT * FROM Customers
WHERE Country = 'Germany' ORDER BY City; -- City 컬럼 기준 정렬

-- 미국 고객들을 이름 순 정렬
SELECT * FROM Customers WHERE Country = 'USA' ORDER BY CustomerName;

-- 기본은 오름차순 정렬
-- 내림 차순 정렬은 DESC 키워드 사용

SELECT * FROM Customers 
WHERE Country = 'USA' ORDER BY CustomerName DESC; -- 미국인 이름 역순 정렬


Country와 City 정렬기준 잡고 싶을떄

Country 기준으로 정렬하고 그 다음 City기준으로 정렬됨

-- 여러 컬럼 기준 정렬 : ORDER BY 다음 컬럼명 나열.
SELECT * FROM Customers ORDER BY Country, City;


-- 고객을 나라, 고객명 정렬 조회
SELECT * FROM Customers ORDER BY Country, CustomerName;

-- 고객을 나라 역순, 고객명 오름차순 정렬
SELECT * FROM Customers ORDER BY Country DESC, CustomerName ASC; (ASC 생략가능)

 

 

05orderBy

 

-- ORDER BY : 정렬
SELECT * FROM Customers;

SELECT * FROM Customers WHERE Country = 'Germany';
SELECT * FROM Customers WHERE Country = 'Germany' ORDER BY City; -- City 컬럼 기준 정렬

-- 미국 고객들을 이름 순 정렬
SELECT * FROM Customers WHERE Country = 'USA' ORDER BY CustomerName;

-- 기본은 오름차순 정렬
-- 내림 차순 정렬은 DESC 키워드 사용

SELECT * FROM Customers WHERE Country = 'USA' ORDER BY CustomerName DESC; -- 미국인 이름 역순 정렬

-- 독딜인 고객을 도시명 기준 역순으로 정렬 조회
SELECT * FROM Customers WHERE Country ='Germany' ORDER BY City DESC;

-- 여러 컬럼 기준 정렬 : ORDER BY 다음 컬럼명 나열.
SELECT * FROM Customers ORDER BY Country, City;

-- 고객을 나라, 고객명 정렬 조회
SELECT * FROM Customers ORDER BY Country, CustomerName;

-- 고객을 나라 역순, 고객명 오름차순 정렬
SELECT * FROM Customers ORDER BY Country DESC, CustomerName;

SELECT * FROM Customers ORDER BY Country DESC, CustomerName ASC; -- ASC : 생략기능 

-- 고객을 Country ASC, City ASC, CustomerName DESC 정렬 조회
SELECT * FROM Customers ORDER BY Country, City, CustomerName DESC;

 

 

 

 

 

 

○결과값

 

 

 

 

-----------------------------------------------오후------------------------------------

 

 

이클립스 와 mysql 을 연동하려면

연결정보를 넣어야함

깃이 정보에 유출안되게


Repository -> setting  -> ignored files


/bin/
/build/
.project
.classpath
.settings/
*.properties <- 추가


WEB-INF 우클릭 new file
파일이름
db.properties

key =value 쌍으로 저장



jdbc

src -> jdbc01패키지

JDBCListener1 -> 첫번쨰꺼만 체크

 

 

 

application의 또다른 이름 ServletContext


키= value 기반으로 작성한걸

map으로 만들어주는 객체

Property 객체

주소 가려서 올려 !


JDBCListener1.java 작성후

구글에 
mariadb jdbc driver download
검색후 들어가서

https://mariadb.com/kb/en/installing-mariadb-connectorj/

다운

// jdbc:mariadb://ip:port/schema?user=username&password=password

 

 

 

 

 

 

 

 

★JDBCListener1, JDBC01Servlet ,v01jsp

 

 

 

JDBCListener1

package jdbc01;

import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

import org.mariadb.jdbc.MariaDbPoolDataSource;

/**
 * Application Lifecycle Listener implementation class JDBCListener1
 *
 */
@WebListener
public class JDBCListener1 implements ServletContextListener {
	
	private MariaDbPoolDataSource pool = null;
	/**
	 * Default constructor.
	 */
	public JDBCListener1() {
		// TODO Auto-generated constructor stub
	}

	/**
	 * @see ServletContextListener#contextDestroyed(ServletContextEvent)
	 */
	public void contextDestroyed(ServletContextEvent sce) {
		if (pool != null) {
			pool.close();
		}
	}

	/**
	 * @see ServletContextListener#contextInitialized(ServletContextEvent)
	 */
	public void contextInitialized(ServletContextEvent sce) {

		ServletContext application = sce.getServletContext();

		String path = "/WEB-INF/db.properties";
		InputStream is = null;
		
		Connection connection = null;

		try {
			is = application.getResourceAsStream(path);

			Properties props = new Properties();
			props.load(is);

//			System.out.println(props.get("user"));
//			System.out.println(props.get("password"));
//			System.out.println(props.get("ip"));
//			System.out.println((props.get("schema")));
			
			// jdbc:mariadb://ip:port/schema?user=username&password=password
			
			String ip = props.getProperty("ip");
			String schema = props.getProperty("schema");
			String user = props.getProperty("user");
			String password = props.getProperty("password");
			
			String dburl ="jdbc:mariadb://" + ip + "/" +schema + "?user=" + user + "&password=" + password;
			
			System.out.println(dburl);
			
			
			pool = new MariaDbPoolDataSource(dburl);

			pool.setMaxPoolSize(1);
			
    		connection = pool.getConnection();
    		Statement stmt = connection.createStatement();
    		ResultSet rs = stmt.executeQuery("SELECT 333");
    		if (rs.next()) {
//    			System.out.println(rs.getInt(1)); // 333 출력되면 쿼리 실행 OK
    			if (rs.getInt(1) == 333 ) {
    				System.out.println("데이터 베이스 연결완료!");
    			}
    		}			
			
    		application.setAttribute("dbpool", pool);
    		
			
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			if( connection != null) {
				try {
					connection.close();
				} catch (SQLException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}
			}
			if (is != null) {
				try {
					is.close();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
		}

	}

}



 


JDBC01Servlet

package jdbc01;

import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;

/**
 * Servlet implementation class JDBC01Servlet
 */
@WebServlet("/jdbc01/s01")
public class JDBC01Servlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public JDBC01Servlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//		System.out.println("jdbc01 s01 일함.");
		
		ServletContext application = request.getServletContext();
		
		
		String sql = "SELECT CustomerName FROM Customers WHERE CustomerID = 1";
		
		DataSource pool = (DataSource) application.getAttribute("dbpool"); // 연결들을 가지고 있는 객체
		
		try (Connection con = pool.getConnection(); // db와의 연결 정보를 가진 객체
			Statement stmt = con.createStatement(); //쿼리 실행을 위한 객체
			) {
			ResultSet rs = stmt.executeQuery(sql); // 쿼리 실행 결과를 저장한 객체
		
			if (rs.next()) {
				String name = rs.getString(1);
				System.out.println(name);
			
				request.setAttribute("customerName", name);
			}
			
		} catch (Exception e ) {
			e.printStackTrace();
		}
		
		//forward
		String view = "/WEB-INF/view/jdbc01/v01.jsp";
		request.getRequestDispatcher(view).forward(request, response);
		
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

 

 

 

WEB-INF 의 view
jdbc01 폴더 안에
v01.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"  %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>


<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<link rel="stylesheet" href="<%= request.getContextPath() %>/resource/css/icon/css/all.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous">
<title>Insert title here</title>
</head>
<body>

<h1>이거 쓰기힘드네</h1>
<p>${LastName }</p>


<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-fQybjgWLrvvRgtW6bFlB7jaZrFsaBXjsOMm/tB9LTS58ONXgqbR9W8oWht/amnpF" crossorigin="anonymous"></script>
</body>
</html>

 

 

 

○결과값

 

 

 

★JDBC02Servlet

 


요청이
/jdbc01/s02
위 경로로 왔을 때
JDBC02Servlet
이 일해서

 SELECT LastName FROM Employees WHERE EmployeeID = 1;

의 결과

Davolio

가 콘솔에 출력하도록 

코드를 작성하세요


src -> jdbc01 -> JDBC02Servlet

WEB-INF -> 


WebContent -> view -> jdbc01 -> v011.jsp

 

 

 

JDBC02Servlet

package jdbc01;

import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;

/**
 * Servlet implementation class JDBC02Servlet
 */
@WebServlet("/jdbc01/s02")
public class JDBC02Servlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public JDBC02Servlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		//System.out.println("jdbc2 일함");
		ServletContext application = request.getServletContext();
		
		String sql = "SELECT LastName FROM Employees WHERE EmployeeID = 1";
		
		DataSource pool = (DataSource) application.getAttribute("dbpool"); // 연결들을 가지고 있는 객체
		
		try (Connection con = pool.getConnection(); // db와의 연결 정보를 가진 객체
			Statement stmt = con.createStatement(); // 쿼리실행을 위한 객체
			) {
			ResultSet rs = stmt.executeQuery(sql); // 쿼리 실행 결과를 저장한 객체
			
			if (rs.next()) {
				String name = rs.getString(1);
				System.out.println(name);
				
				request.setAttribute("LastName", name);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		// forward
		String view = "/WEB-INF/view/jdbc01/v011.jsp";
		request.getRequestDispatcher(view).forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		doGet(request, response);
	}

}

 

 

v011.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"  %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>


<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<link rel="stylesheet" href="<%= request.getContextPath() %>/resource/css/icon/css/all.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/css/bootstrap.min.css" integrity="sha384-zCbKRCUGaJDkqS1kPbPd7TveP5iyJE0EjAuZQTgFLD2ylzuqKfdKlfG/eSrtxUkn" crossorigin="anonymous">
<title>Insert title here</title>
</head>
<body>

<h1>이거 쓰기힘드네</h1>
<p>${LastName }</p>


<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-fQybjgWLrvvRgtW6bFlB7jaZrFsaBXjsOMm/tB9LTS58ONXgqbR9W8oWht/amnpF" crossorigin="anonymous"></script>
</body>
</html>

 

 

○결과값