JQuery.load()는 Ajax의 일종이다.
서버에서 데이터를 로드하고 반환된 HTML을 일치하는 요소에 배치합니다.
이는 /about/chProfile.wow에 요청에 대한 결과화면이다.
aboutHome.jsp
<ul class="nav nav-tabs" role="tablist" id="myTab">
<li role="presentation" class="active"><a href="chProfile" aria-controls="chProfile" role="tab" data-toggle="tab">창희프로필</a></li>
<li role="presentation"><a href="chAlcohol" aria-controls="chAlcohol" role="tab" data-toggle="tab">창희의술</a></li>
<li role="presentation"><a href="chPiano" aria-controls="chPiano" role="tab" data-toggle="tab">창희의 피아노</a></li>
</ul>
<div class="tab-content">
</div>
</body>
<script>
$(".tab-content").load("<c:url value='chProfile.wow' />");
</script>
이는 /about/aboutHome.wow에 대한 결과화면이고
jquery.load로 /about/chProfile.wow를 요청해 그 결과를
".tab-content" 태그에 배치하였습니다.
그래서 보통 jquery.load 에서는 해당 요청에 대한 결과가 특정 화면(html) 일 때 사용합니다.
jQuery .load() 메소드 사용법
.load( url [, data ] [, complete ] ) 반환값: jQuery
- url : 데이터를 받을 URL을 나타내는 문자열입니다.
- data : 선택적인 인자로 URL 로 요청을 보낼 때 같이
보낼 데이터로 자바스크립트 객체 또는 문자열 입니다.
- complete : 요청이 완료되면 호출되어질 콜백함수 입니다.
data와 HTTP 요청 메소드(Request Method)
두 번째 인자인 data가 주어지면 POST 메소드로 보내어지고,
그 외의 경우에는 GET 방식으로 보내어집니다.
콜백 함수(Callback Function)
콜백함수는 요청이 완료되고 나서 실행됩니다.
$(".tab-content").load("<c:url value='chProfile.wow' />", function() {
alert("chProfile이 로드되었습니다");
});
실습
aboutHome.jsp에서 tab을 이용해 tab을 클릭할 때 마다
".tab-content"에 다음과 같이 배치되도록 해봅시다.
jquery.load()를 사용하는 이유는 AJAX와 마찬가지로
동적컨텐츠를 처리해서 ".tab-content"에 배치시킬 수 있다는 것입니다.
창희의 술에서는 Alcohol 테이블의 데이터를 조회해서 만들어진 jsp화면을 배치시키고,
창희의 피아노에서는 Piano 테이블의 데이터를 조회해서 만들어진 jsp화면을 배치시키겠습니다.
먼저 DB에 더미로 데이터를 넣어봅시다.
Alcohol.sql
CREATE TABLE alcohol (
al_no NUMBER
,al_name VARCHAR(100)
,al_percent NUMBER
,al_category CHAR(4)
,CONSTRAINT alcohol_pk PRIMARY KEY (al_no)) ;
CREATE SEQUENCE seq_alcohol;
Insert into ALCOHOL (AL_NO,AL_NAME,AL_PERCENT,AL_CATEGORY) values (seq_alcohol.nextval,'려驪 증류소주 45',45,'AC02');
Insert into ALCOHOL (AL_NO,AL_NAME,AL_PERCENT,AL_CATEGORY) values (seq_alcohol.nextval,'려驪 증류소주 20',20,'AC02');
Insert into ALCOHOL (AL_NO,AL_NAME,AL_PERCENT,AL_CATEGORY) values (seq_alcohol.nextval,'산토리 가쿠빈',40,'AC02');
Insert into ALCOHOL (AL_NO,AL_NAME,AL_PERCENT,AL_CATEGORY) values (seq_alcohol.nextval,'잭 다니엘 ',40,'AC02');
Insert into ALCOHOL (AL_NO,AL_NAME,AL_PERCENT,AL_CATEGORY) values (seq_alcohol.nextval,'잭 다니엘 허니 ',35,'AC02');
Insert into ALCOHOL (AL_NO,AL_NAME,AL_PERCENT,AL_CATEGORY) values (seq_alcohol.nextval,'디 카이퍼 크림 드 카시스 ',15,'AC03');
Insert into ALCOHOL (AL_NO,AL_NAME,AL_PERCENT,AL_CATEGORY) values (seq_alcohol.nextval,'디 카이퍼 피치트리 ',20,'AC03');
Insert into ALCOHOL (AL_NO,AL_NAME,AL_PERCENT,AL_CATEGORY) values (seq_alcohol.nextval,'디 카이퍼 애플퍼커 ',15,'AC03');
Insert into ALCOHOL (AL_NO,AL_NAME,AL_PERCENT,AL_CATEGORY) values (seq_alcohol.nextval,'마티니 엑스트라 드라이',18,'AC02');
Insert into ALCOHOL (AL_NO,AL_NAME,AL_PERCENT,AL_CATEGORY) values (seq_alcohol.nextval,'쿠에르포 모히또',15,'AC03');
Insert into ALCOHOL (AL_NO,AL_NAME,AL_PERCENT,AL_CATEGORY) values (seq_alcohol.nextval,'팔리니 리몬첼로',26,'AC03');
Insert into ALCOHOL (AL_NO,AL_NAME,AL_PERCENT,AL_CATEGORY) values (seq_alcohol.nextval,'짐빔 화이트',40,'AC02');
Insert into ALCOHOL (AL_NO,AL_NAME,AL_PERCENT,AL_CATEGORY) values (seq_alcohol.nextval,'벨스 오리지널',40,'AC02');
Insert into ALCOHOL (AL_NO,AL_NAME,AL_PERCENT,AL_CATEGORY) values (seq_alcohol.nextval,'아그와 오리지널',30,'AC03');
Insert into ALCOHOL (AL_NO,AL_NAME,AL_PERCENT,AL_CATEGORY) values (seq_alcohol.nextval,'미도리',23,'AC03');
Piano.sql
CREATE TABLE piano (
p_no NUMBER
,p_title VARCHAR(100)
,p_date DATE
,p_composer VARCHAR(100)
,p_category CHAR(4)
,CONSTRAINT piano_pk PRIMARY KEY(p_no) );
CREATE SEQUENCE seq_piano;
Insert into PIANO (P_NO,P_TITLE,P_DATE,P_COMPOSER,P_CATEGORY) values (seq_piano.nextval,'아들린느를 위한 발라드',to_date('20/08/24','RR/MM/DD'),'폴 드 세느빌','PC01');
Insert into PIANO (P_NO,P_TITLE,P_DATE,P_COMPOSER,P_CATEGORY) values (seq_piano.nextval,'체르니 30번 연습곡 중 26번 ',to_date('20/09/10','RR/MM/DD'),'체르니','PC01');
Insert into PIANO (P_NO,P_TITLE,P_DATE,P_COMPOSER,P_CATEGORY) values (seq_piano.nextval,'소녀의 기도 ',to_date('20/10/13','RR/MM/DD'),'바다체프스카','PC02');
Insert into PIANO (P_NO,P_TITLE,P_DATE,P_COMPOSER,P_CATEGORY) values (seq_piano.nextval,'슈베르트 즉흥곡 2번',to_date('21/07/23','RR/MM/DD'),'슈베르트','PC01');
Insert into PIANO (P_NO,P_TITLE,P_DATE,P_COMPOSER,P_CATEGORY) values (seq_piano.nextval,'모차르트 왈츠 17',to_date('21/08/26','RR/MM/DD'),'모차르트','PC01');
Insert into PIANO (P_NO,P_TITLE,P_DATE,P_COMPOSER,P_CATEGORY) values (seq_piano.nextval,'은파',to_date('21/01/16','RR/MM/DD'),'와이먼','PC02');
Insert into PIANO (P_NO,P_TITLE,P_DATE,P_COMPOSER,P_CATEGORY) values (seq_piano.nextval,'Lake louise',to_date('21/09/10','RR/MM/DD'),'유키 구라모토','PC02');
Insert into PIANO (P_NO,P_TITLE,P_DATE,P_COMPOSER,P_CATEGORY) values (seq_piano.nextval,'아라베스크 no.1',to_date('21/11/26','RR/MM/DD'),'드뷔시','PC01');
Insert into PIANO (P_NO,P_TITLE,P_DATE,P_COMPOSER,P_CATEGORY) values (seq_piano.nextval,'녹턴 no.2',to_date('20/09/24','RR/MM/DD'),'쇼팽','PC01');
Insert into PIANO (P_NO,P_TITLE,P_DATE,P_COMPOSER,P_CATEGORY) values (seq_piano.nextval,'작은별 변주곡',to_date('21/05/03','RR/MM/DD'),'모차르트','PC01');
Insert into PIANO (P_NO,P_TITLE,P_DATE,P_COMPOSER,P_CATEGORY) values (seq_piano.nextval,'Etude op.10 no.5 흑건',to_date('22/05/01','RR/MM/DD'),'쇼팽','PC01');
commit빼먹지 맙시다.
VO도 만들어줍시다.
package com.study.about.vo;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
public class AlcoholVO {
private int alNo;
private String alName;
private int alPercent;
private String alCategory;
//toString, getter/setter
}
package com.study.about.vo;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
public class PianoVO {
private int pNo;
private String pTitle;
private String pDate;
private String pComposer;
private String pCategory;
//toString, getter/setter
}
요청을 처리할 Controller 및 DB조회를 위한 service,DAO를 만듭시다.
AboutController
package com.study.about.web;
import java.util.List;
import javax.inject.Inject;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import com.study.about.service.AboutServiceImpl;
import com.study.about.vo.AlcoholVO;
import com.study.about.vo.PianoVO;
@Controller
public class AboutController {
@Inject
AboutServiceImpl aboutService;
@RequestMapping(value="/about/aboutHome.wow")
public String aboutHome() {
return "about/aboutHome";
}
//jsp가 그대로 jqueryLoad 대상태그에 그대로
@RequestMapping(value="/about/chProfile.wow")
public String aboutChProfile(Model model) {
return "about/chProfile";
}
@RequestMapping(value="/about/chAlcohol.wow")
public String aboutChAlchohol(Model model) {
List<AlcoholVO> alcoholList=aboutService.chAlcohol();
model.addAttribute("alcoholList",alcoholList);
return "about/chAlcohol";
}
@RequestMapping(value="/about/chPiano.wow")
public String aboutChPiano(Model model) {
List<PianoVO> pianoList=aboutService.chPiano();
model.addAttribute("pianoList",pianoList);
return "about/chPiano";
}
}
AboutServiceImpl
package com.study.about.service;
import java.util.List;
import javax.inject.Inject;
import org.springframework.stereotype.Service;
import com.study.about.dao.IAboutDao;
import com.study.about.vo.AlcoholVO;
import com.study.about.vo.PianoVO;
@Service
public class AboutServiceImpl {
@Inject
IAboutDao aboutDao;
public List<AlcoholVO> chAlcohol(){
return aboutDao.getAlcoholList();
}
public List<PianoVO> chPiano(){
return aboutDao.getPianoList();
}
}
IAboutDao
package com.study.about.dao;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import com.study.about.vo.AlcoholVO;
import com.study.about.vo.PianoVO;
@Mapper
public interface IAboutDao {
public List<AlcoholVO> getAlcoholList();
public List<PianoVO> getPianoList();
}
about.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.study.about.dao.IAboutDao">
<select id="getAlcoholList" resultType="com.study.about.vo.AlcoholVO">
SELECT al_no
, al_name
, al_percent
, al_category
FROM alcohol
</select>
<select id="getPianoList" resultType="com.study.about.vo.PianoVO">
SELECT p_no
, p_title
, p_date
, p_composer
, p_category
FROM piano
</select>
</mapper>
jsp입니다. 경로는 spring 프로젝트에 맞게 잘 맞춰줍시다.
aboutHome.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
request.setCharacterEncoding("UTF-8");
%>
<!DOCTYPE html>
<html>
<head>
<%@include file="/WEB-INF/inc/header.jsp" %>
<title></title>
</head>
<body>
<%@include file="/WEB-INF/inc/top.jsp" %>
<ul class="nav nav-tabs" role="tablist" id="myTab">
<li role="presentation" class="active"><a href="chProfile" aria-controls="chProfile" role="tab" data-toggle="tab">창희프로필</a></li>
<li role="presentation"><a href="chAlcohol" aria-controls="chAlcohol" role="tab" data-toggle="tab">창희의술</a></li>
<li role="presentation"><a href="chPiano" aria-controls="chPiano" role="tab" data-toggle="tab">창희의 피아노</a></li>
</ul>
<div class="tab-content">
</div>
</body>
<script>
$(document).ready(function(){
//처음 시작할 땐 chProfile이 나와야한다.
$(".tab-content").load("<c:url value='chProfile.wow' />");
//탭 클릭시마다
$("#myTab li a").on("click", function(e){
e.preventDefault();
var page=$(this).attr("href");
$(".tab-content").load("<c:url value='"+page+".wow' />");
});
});
</script>
</html>
chProfile.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
request.setCharacterEncoding("UTF-8");
%>
<!DOCTYPE html>
<html>
<head>
<%@include file="/WEB-INF/inc/header.jsp" %>
<title></title>
</head>
<body>
<div class="col-sm-6">
<div class="team-member">
<img src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAoHCBYWFRgWFRYZGRgYGBgYGhgYGBgYGBgYGBgZGRgYGBgcIS4lHB4rIRgYJjgmKy8xNTU1GiQ7QDs0Py40NTEBDAwMEA8QHhISHzQrJCs0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ9NDQ0NP/AABEIALcBEwMBIgACEQEDEQH/xAAbAAACAwEBAQAAAAAAAAAAAAA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qSeGlaehpwAnwWjL8dcTy8W6p8getUxCWGnyndW0xhKbk7Soc212bFh09Jg+xcvPaLkOSB7D/QX2cqquyCB4rlyrJLP5NJpNkC0HyV19SgYXLlT6MabMXqTSHz5p/YyWBcuS14LR/ImWQVJ7yIXq5L9Br+QQxYTW9SaxznmS5xJA6NB4+a5cpZvKPR9E2pqkZK4uy8yeqHqcLlyCOpt+QSsVptPb3G/pH2XLkcv8UN6L/I/9F7gQrGulcuWdHpsFrjKHK5cnRns8eePn9lHlcuTEvtk+EPcVMLly5eQX4BV7C5cnM5FxQVdcuTyQzeDymUawrly6jsPgIo3EGE2se5Up1B0eyR5bh+8Llyk/JsjuXs+jaVdAHKcOvegXLlqPLQQ18tSTVG96AuXINLiJGSufkChcuXKB6Gz/9k=" class="img-responsive img-circle" alt="칸">
<h4>한 창 희</h4>
<div class="text-left">
<ul title="경력">
<li>전임 강사</li>
<li>강의 2년</li>
</ul>
<ul title="강의">
<li>JAVA, JSP, SPRING,DB,<br> Android, Arduino <br>
</li>
</ul>
<ul title="자격">
<li>정보처리기사</li>
<li>직업능력개발 훈련교사(정보기술운영관리,무선통신구축,정보기술개발)</li>
</ul>
<ul title="실무경력" style="list-style-type:circle;">
<li>미츠비시전기 나고야 제작소 e-Factory개발</li>
</ul>
</div>
</div>
</div>
</body>
</html>
chAlcohol.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
request.setCharacterEncoding("UTF-8");
%>
<!DOCTYPE html>
<html>
<head>
<%@include file="/WEB-INF/inc/header.jsp" %>
<title></title>
</head>
<body>
<h1>창희가 먹어본 술 <small>- 술 구매는 코스트코가 최고입니다</small></h1>
<table class="table table-striped table-bordered">
<tr>
<th>번호</th>
<th>술이름</th>
<th>도수</th>
<th>분류</th>
</tr>
<c:forEach items="${alcoholList }" var="alcohol">
<tr>
<td>${alcohol.alNo }</td>
<td>${alcohol.alName }</td>
<td>${alcohol.alPercent }</td>
<td>${alcohol.alCategory }</td>
</tr>
</c:forEach>
</table>
</body>
</html>
chPiano.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
request.setCharacterEncoding("UTF-8");
%>
<!DOCTYPE html>
<html>
<head>
<%@include file="/WEB-INF/inc/header.jsp" %>
<title></title>
</head>
<body>
<h1>이제 그만 발라드1번을 치고 싶어요</h1>
<table class="table table-striped table-bordered">
<tr>
<th>번호</th>
<th>제목</th>
<th>날짜</th>
<th>작곡가</th>
<th>분류</th>
</tr>
<c:forEach items="${pianoList }" var="piano">
<tr>
<td>${piano.pNo }</td>
<td>${piano.pTitle }</td>
<td>${piano.pDate }</td>
<td>${piano.pComposer }</td>
<td>${piano.pCategory }</td>
</tr>
</c:forEach>
</table>
</body>
</html>
※jquery.load에 의한 요청도 DispatcherServlet이 처리한다.
만약 이 요청이 Interceptor에 걸린다면 해당 결과는 login.jsp가 나올것이다.
이 때 interceptor에서 응답코드를 어떻게 보내느냐에 따라 화면에는 아무런 변화가 없을 수도 있다.