쌤이 준 파일 resources 파일에 갖다 붙히기 

 

3개 우클릭한 후 노트패드로 열기 

spring2_board_list 복사해서 

noticeboard 폴더에 list.jsp 에 갖다붙이기

 

//pom.xml

	<!-- Tiles 라이브러리 의존관계 등록 시작 -->
		<dependency>
			<groupId>org.apache.tiles</groupId>
			<artifactId>tiles-core</artifactId>
			<version>3.0.8</version>
		</dependency>
		
		<dependency>
			<groupId>org.apache.tiles</groupId>
			<artifactId>tiles-extras</artifactId>
			<version>3.0.8</version>
		</dependency>
		
		<dependency>
			<groupId>org.apache.tiles</groupId>
			<artifactId>tiles-servlet</artifactId>
			<version>3.0.8</version>
		</dependency>
		
		<dependency>
			<groupId>org.apache.tiles</groupId>
			<artifactId>tiles-jsp</artifactId>
			<version>3.0.8</version>
		</dependency>
			<!-- Tiles 라이브러리 의존관계 등록 끝 -->

메이븐 -> 프로젝트 업데이트

 

kr.or.ddit.controller.tiles 패키지 만든후 TilesSettingsController 클래스 

만듬

 

/*
	 	============= 부트 스트랩을 이용한 CRUD를 진행해봅시다 ! ================
	 	
	 	# 페이지 모듈화를 위한 Tiles를 함께 사용하여 CRUD를 진행합니다.
	 	
	 	1. Tiles란?
	 	- 어떤 jsp를 템플릿으로 사용하고 템플릿의 각 영역을 어떤 내용으로 채울지에 대한 정보를 설정한다.
	 	- 하나의 화면들을 만들다보면 공통적이고 반복적으로 생성해야하는 header, footer와 같은 영역들이 존재한다.
	 		우리는 그러한 공통부들을 분리하여 반복적으로 컴포넌트들을 사용하는게 아닌 공통적인 부분은 한번만 가져다 쓰고
	 		변화하는 부분에 대해서만 동적으로 변환해 페이지를 관리할수 있어야할것입니다.
	 		이렇게 , header/footer/menu등 공통적인 소스를 분리하여 한 화면에서 동적으로 레이아웃을 한곳에 배치하여 설정하고
	 		관리 할 수 있도록 도와주는 페이지 모듈화를 돕는 프레임워크이다. 
	 		
	 		- 아래 jsp를 이용하여 페이지 모듈화 진행
	 		template.jsp
	 		> header.jsp
	 		> content source
	 		> footer.jsp
	 		
	 		** 그외 다양한 영역의 페이지는 구현하고자 하는 시나리오를 바탕으로 페이지가 구성될 때 추가적으로 레이아웃 영역을 분리하여
	 		작성하면 됩니다	 		
	 		
	 		2. Tiles Layout 구현 설정
	 		
	 		1) Tiles 의존 관계 등록
	 		
	 		-titles-core
	 		- titles-servlet
	 		- titles-extras
	 		- titles-jsp
	 		
	 		**의존 관계 등록 후 Maven > Update Projects
	 		*
	 		*2) servlet-content.xml 수정
	 		*- ViewResolver order 순서 2 순위로 지정
	 		*- titlesViewResolver Bean 등록
	 		*
	 		*3) titles 설정위한 xml설정
	 		* /WEB-INF/spring/tiles-config.xml
	 		
	 		4)tiles xml 에 설정한 layout 설정대로 페이지생성(jsp) 
	 
	 
	 
	 */

그다음 

 

   <!-- Tiles bean 등록 진행 : Tiles를 이용한 페이지 모듈화 -->
   <beans:bean id="tilesViewResolver" 
      class="org.springframework.web.servlet.view.UrlBasedViewResolver">
      <beans:property name="viewClass" 
      value="org.springframework.web.servlet.view.tiles3.TilesView"/>
      <beans:property name="order" value="1"/> 
   </beans:bean>
   <beans:bean id="tilesConfigurer"
      class="org.springframework.web.servlet.view.tiles3.TilesConfigurer">
      <beans:property name="definitions">
         <beans:list>
            <beans:value>/WEB-INF/spring/tiles-config.xml</beans:value>
         </beans:list>
      </beans:property>
   </beans:bean> 
   <!-- Tiles를 이용한 페이지 설정 끝 -->

추가 해준다 

 

 

구글에 tiles dtd 검색

tiles-config.xml에 저 한줄을 복붙하면 <tiles만 쳐도 태그 자동완성할수 있다.

<?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN" "http://tiles.apache.org/dtds/tiles-config_3_0.dtd">
 <tiles-definitions>
 <!--  
 	//notice/a/b
  -->
  
  	<definition name="mainTemplate" template="/WEB-INF/views/mainTemplate.jsp">
  		<put-attribute name="header" value="/WEB-INF/views/tiles/header.jsp"/>
  		<put-attribute name="footer" value="/WEB-INF/views/tiles/footer.jsp"/>
  	</definition>
  
 	<definition name="notice/*" extends="mainTemplate">
 		<put-attribute name="content" value="/WEB-INF/views/noticeboard/{1}.jsp"/>
 	</definition>
 
 </tiles-definitions>

views 폴더에 mainTemplate.jsp 만들고 list에 붙였던 전체를 자르고 갖다 붙힌다. 

 

그다음 views 폴더에 tiles 폴더를 만들고 header.jsp 와 footer.jsp 만들고

각각 그 영역에 맞는 코드를 mainTemplate.jsp에 갖다 붙이고 

 

//mainTemplate


<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib uri="http://tiles.apache.org/tags-tiles"  prefix="tiles"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>AdminLTE 3 | Simple Tables</title>


<link rel="stylesheet"
	href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">

<link rel="stylesheet"
	href="../../plugins/fontawesome-free/css/all.min.css">

<link rel="stylesheet" href="../../dist/css/adminlte.min.css">
</head>

<body class="hold-transition sidebar-mini">
	<div class="wrapper">
<!--  header 영역 -->
	<tiles:insertAttribute name="header"/>
		<div class="content-wrapper">
<tiles:insertAttribute name="content"/>
		
		</div>
<!-- footer 영역 -->
	<tiles:insertAttribute name="footer"></tiles:insertAttribute>

		<aside class="control-sidebar control-sidebar-dark"></aside>

	</div>

	<script src="../../plugins/jquery/jquery.min.js"></script>

	<script src="../../plugins/bootstrap/js/bootstrap.bundle.min.js"></script>

	<script src="../../dist/js/adminlte.min.js"></script>
</body>
</html>

../../에 ${pageContext.request.contextPath }/resources/ 추가해줌

 

//mainTemplate

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib uri="http://tiles.apache.org/tags-tiles"  prefix="tiles"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>AdminLTE 3 | Simple Tables</title>


<link rel="stylesheet"
	href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">

<link rel="stylesheet"
	href="${pageContext.request.contextPath }/resources/plugins/fontawesome-free/css/all.min.css">

<link rel="stylesheet" href="${pageContext.request.contextPath }/resources/dist/css/adminlte.min.css">
</head>

<body class="hold-transition sidebar-mini">
	<div class="wrapper">
		<!--  header 영역 -->
		<tiles:insertAttribute name="header"/>
		<div class="content-wrapper">
			<tiles:insertAttribute name="content"/>
		</div>
		<!-- footer 영역 -->
	<tiles:insertAttribute name="footer"/>

		<aside class="control-sidebar control-sidebar-dark"></aside>

	</div>

	<script src="${pageContext.request.contextPath }/resources/plugins/jquery/jquery.min.js"></script>

	<script src="${pageContext.request.contextPath }/resources/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>

	<script src="${pageContext.request.contextPath }/resources/dist/js/adminlte.min.js"></script>
</body>
</html>

 

// header.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
   pageEncoding="UTF-8"%>
<nav class="main-header navbar navbar-expand navbar-white navbar-light">
   <ul class="navbar-nav">
      <li class="nav-item"><a class="nav-link" data-widget="pushmenu"
         href="#" role="button"><i class="fas fa-bars"></i></a></li>
   </ul>
</nav>
<aside class="main-sidebar sidebar-dark-primary elevation-4">
   <a href="" class="brand-link"> 
   <img src="${pageContext.request.contextPath }/resources/dist/img/AdminLTELogo.png" alt="AdminLTE Logo"
      class="brand-image img-circle elevation-3" style="opacity: .8">
      <span class="brand-text font-weight-light">SPRING</span>
   </a>

   <div class="sidebar">
      <div class="user-panel mt-3 pb-3 mb-3 d-flex">
         <div class="image">
            <img src="${pageContext.request.contextPath }/resources/dist/img/user2-160x160.jpg"
               class="img-circle elevation-2" alt="User Image">
         </div>
         <div class="info">
            <a href="#" class="d-block">DDIT Spring</a>
         </div>
      </div>
      <nav class="mt-2">
         <ul class="nav nav-pills nav-sidebar flex-column"
            data-widget="treeview" role="menu" data-accordion="false">
            <!-- Add icons to the links using the .nav-icon class
               with font-awesome or any other icon font library -->
            <li class="nav-item"><a href="#" class="nav-link"> <i
                  class="nav-icon fas fa-tachometer-alt"></i>
                  <p>공지사항</p>
            </a></li>
         </ul>
      </nav>
   </div>
</aside>
footer.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
	<footer class="main-footer">
			<div class="float-right d-none d-sm-block">
				<b>Version</b> 1.0.0
			</div>
			<strong>Copyright &copy; 2014-2021 <a href="#">DDIT
					SPRING</a>.
			</strong> All rights reserved.
		</footer>

noticeboard 폴더에 form.jsp와 detail.jsp 추가 

 

NoticeRetrieveController .java에서

 

package kr.or.ddit.controller.crud.notice;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Controller
@RequestMapping("/notice")
public class NoticeRetrieveController {

		@RequestMapping(value="/list.do" , method = RequestMethod.GET)
		public String noticeList() {
			log.info("noticeList 실행");
			return "notice/list";
		}
		@RequestMapping(value="/detail.do" , method = RequestMethod.GET)
		public String noticeDetail() {
			log.info("noticeDetail() 실행");
			return "notice/detail";
		}
}

 

//form.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
 
  <section class="content">	 
	  <div class="row">
		<div class="col-md-12">
			<div class="card card-dark">
				<div class="card-header">
					<h3 class="card-title">공지사항 등록</h3>
					<div class="card-tools">

					</div>
				</div>
				<div class="card-body">
					<div class="form-group">
						<label for="inputName">제목을 입력해주세요</label>
						<input type="text" id="inputName" class="form-control" placeholder="제목을 입력해주세요">
					</div>
					<div class="form-group">
						<label for="inputDescription">내용을 입력해주세요</label>
						<textarea id="inputDescription" class="form-control" rows="14"></textarea>
					</div>
					<div class="form-group">
						<div class="custom-file">
							
							<input type="file" class="custom-file-input" id="customFile" multiple="multiple">
							<label class="custom-file-label" for="customFile">파일을 선택해주세요</label>
						</div>
					</div>
				</div>
			
				<div class="card-footer bg-white">
				  <ul class="mailbox-attachments d-flex align-items-stretch clearfix">
					<li>
					  <span class="mailbox-attachment-icon"><i class="far fa-file-pdf"></i></span>

					  <div class="mailbox-attachment-info">
						<a href="#" class="mailbox-attachment-name"><i class="fas fa-paperclip"></i> Sep2014-report.pdf</a>
							<span class="mailbox-attachment-size clearfix mt-1">
							  <span>1,245 KB</span>
							  <a href="#" class="btn btn-default btn-sm float-right"><i class="fas fa-times"></i></a>
							</span>
					  </div>
					</li>
					<li>
					  <span class="mailbox-attachment-icon"><i class="far fa-file-word"></i></span>

					  <div class="mailbox-attachment-info">
						<a href="#" class="mailbox-attachment-name"><i class="fas fa-paperclip"></i> App Description.docx</a>
							<span class="mailbox-attachment-size clearfix mt-1">
							  <span>1,245 KB</span>
							  <a href="#" class="btn btn-default btn-sm float-right"><i class="fas fa-times"></i></a>
							</span>
					  </div>
					</li>
					<li>
					  <span class="mailbox-attachment-icon has-img"><img src="${pageContext.request.contextPath }/resources/ dist/img/photo1.png" alt="Attachment"></span>

					  <div class="mailbox-attachment-info">
						<a href="#" class="mailbox-attachment-name"><i class="fas fa-camera"></i> photo1.png</a>
							<span class="mailbox-attachment-size clearfix mt-1">
							  <span>2.67 MB</span>
							  <a href="#" class="btn btn-default btn-sm float-right"><i class="fas fa-times"></i></a>
							</span>
					  </div>
					</li>
					<li>
					  <span class="mailbox-attachment-icon has-img"><img src="${pageContext.request.contextPath }/resources/ dist/img/photo2.png" alt="Attachment"></span>

					  <div class="mailbox-attachment-info">
						<a href="#" class="mailbox-attachment-name"><i class="fas fa-camera"></i> photo2.png</a>
							<span class="mailbox-attachment-size clearfix mt-1">
							  <span>1.9 MB</span>
							  <a href="#" class="btn btn-default btn-sm float-right"><i class="fas fa-times"></i></a>
							</span>
					  </div>
					</li>
				  </ul>
				</div>
				<div class="card-footer bg-white">
					<div class="row">
						<div class="col-12">
							<input type="button" value="목록" class="btn btn-secondary float-right"> 
							<input type="button" value="등록" class="btn btn-dark float-right">
						</div>
					</div>
				</div>
			</div>
		</div>
		</div>
    </section>
//detail.jsp

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1>공지사항 상세보기</h1>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="#">DDIT HOME</a></li>
              <li class="breadcrumb-item active">공지사항 상세보기</li>
            </ol>
          </div>
        </div>
      </div>
    </section>

    
    <section class="content">
		<div class="container-fluid">
			<div class="row">
				<div class="col-md-12">
					<div class="card card-dark">
						<div class="card-header">
							<h3 class="card-title">제목입니다!!</h3>
							<div class="card-tools">
								관리자 2022-12-12 12:11 1456
							</div>
						</div>
						<form id="quickForm" novalidate="novalidate">
							<div class="card-body">내용입니다.</div>
							<div class="card-footer bg-white">
							<ul class="mailbox-attachments d-flex align-items-stretch clearfix">
								<li>
									<span class="mailbox-attachment-icon">
										<i class="far fa-file-pdf"></i>
									</span>
									<div class="mailbox-attachment-info">
										<a href="#" class="mailbox-attachment-name">
											<i class="fas fa-paperclip"></i> 
											파일명
										</a> 
										<span class="mailbox-attachment-size clearfix mt-1"> 
											<span>파일 Fancy사이즈 KB</span> 
											<a href="다운로드 url"> 
												<span class="btn btn-default btn-sm float-right">
													<i class="fas fa-download"></i>
												</span>
											</a>
										</span>
									</div>
								</li>
							</ul>
						</div>
							<div class="card-footer">
								<button type="submit" class="btn btn-secondary">목록</button>
								<button type="submit" class="btn btn-dark">수정</button>
								<button type="submit" class="btn btn-danger">삭제</button>
							</div>
						</form>
					</div>
				</div>
				<div class="col-md-6"></div>
			</div>
		</div>
    </section>

 

 

-- notice 테이블 만들기 

create table notice(
  bo_no number(8) not null,
  bo_title varchar2(300) not null,
  bo_content varchar2(4000) not null,
  bo_writer varchar2(150) not null,
  bo_date date not null,
  bo_hit number(8) default 0 null,
  constraint pk_notice primary key(bo_no)
 );
 
  create sequence seq_notice increment by 1 start with 1 nocache;
 

 

   create table noticemember(
     mem_no number(8) not null,
      mem_id varchar2(100) not null,
       mem_pw VARCHAR2(100) not null,
        mem_name VARCHAR2(100) not null,
         mem_gender VARCHAR2(30) not null,
          mem_email VARCHAR2(150) not null,
           mem_phone VARCHAR2(150) not null,
            mem_postcode  VARCHAR2(30) not null,
             mem_address1  VARCHAR2(300) not null,
              mem_address2  VARCHAR2(300) not null,
               mem_agree  VARCHAR2(30) not null,
              mem_profileimg  VARCHAR2(500) not null,     
              mem_regdate  date not null,    
              enabled VARCHAR2(2) not null,
              CONSTRAINT pk_noticemember primary key(mem_no)
     );
     
     create sequence seq_noticemember increment by 1 start with 1 nocache;
     
    create table noticemember_auth(
    mem_no number(8) not null,
    auth varchar2(50) not null,
    constraint fk_noticemember_auth_mem_no foreign key(mem_no)
        references noticemember(mem_no)
);

 

 

  -- noticefile 테이블 만들기 
     create table noticefile(
     file_no number(8) not null,
     bo_no number(8) not null,
     file_name varchar2(500) not null,
     file_size number(20) not null,
     file_fancysize varchar2(100) not null,
     file_savepath varchar2(500) not null,
     file_downcount number(8) not null,
     constraint pk_noticefile primary key(file_no),
     CONSTRAINT fk_noticefile_bo_no foreign key(bo_no)
     references notice(bo_no)
     );
     
     
     
      create sequence seq_noticefile increment by 1 start with 1 nocache;
    

압축해제 후 파일을 resources 파일 에 복붙한다.

 

--------pom.xml  -->StringUtils 관련

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.6</version>
</dependency>

package kr.or.ddit.controller.crud.notice;

import java.util.HashMap;
import java.util.Map;

import javax.inject.Inject;

import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import kr.or.ddit.ServiceResult;
import kr.or.ddit.service.INoticeService;
import kr.or.ddit.vo.crud.NoticeVO;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Controller
@RequestMapping("/notice")
public class NoticeInsertController {
	@Inject
	private INoticeService noticeService;
	
	@RequestMapping(value="/form.do", method = RequestMethod.GET)
	public String noticeForm() {
		log.info("noticeForm 실행");
		return "notice/form";
	}
	@RequestMapping(value="/insert.do", method=RequestMethod.POST)
	public String insertNotice(NoticeVO noticeVO, Model model) {
		String goPage = ""; // 이동할 페이지 정보
		
		//넘겨받은 데이터 검증 후, 에러가 발생한 데이터에 대한 에러정보를 담을 공간
		Map<String, String> errors = new HashMap<String, String>();
		if(StringUtils.isBlank(noticeVO.getBoTitle())) { // 제목데이터가 누락되었을때,
			errors.put("boTitle", "제목을 입력해주세요!");
		}
		
		if(StringUtils.isBlank(noticeVO.getBoContent())) { // 제목데이터가 누락되었을때,
			errors.put("boContent", "내용을 입력해주세요!");
		}
		// 기본 데이터의 누락정보에 따른 에러정보 갯수에 따른 처리
		if(errors.size() >0 ) { //에러 갯수가 0보다 클때
			model.addAttribute("errors", errors);
			model.addAttribute("noticeVo", noticeVO);
	}else {//에러가없을때
		noticeVO.setBoWriter("a001"); //임시저장
		ServiceResult result =noticeService.insertNotice(noticeVO);
		if(result.equals(ServiceResult.OK)) { //등록성공
			goPage="redirect:/notice/detail.do?boNo="+noticeVO.getBoNo();
					
		}else {//등록실패
			model.addAttribute("noticeVO", noticeVO);
			model.addAttribute("message","서버에러, 다시시도해주세요");
			goPage ="notice/form";
			
	  }
   }
		return goPage;
}
}
//NoticeRetrieveController.java

package kr.or.ddit.controller.crud.notice;

import javax.inject.Inject;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import kr.or.ddit.service.INoticeService;
import kr.or.ddit.vo.crud.NoticeVO;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@Controller
@RequestMapping("/notice")
public class NoticeRetrieveController {
	@Inject
	private INoticeService noticeService;
		@RequestMapping(value="/list.do" , method = RequestMethod.GET)
		public String noticeList() {
			log.info("noticeList 실행");
			return "notice/list";
		}
		@RequestMapping(value="/detail.do" , method = RequestMethod.GET)
		public String noticeDetail(int boNo, Model model) {
			log.info("noticeDetail() 실행");
			NoticeVO noticeVO = noticeService.selectNotice(boNo);
			model.addAttribute("notice", noticeVO);
			return "notice/detail";
		}
		
}
//INoticeService.java

package kr.or.ddit.service;

import kr.or.ddit.ServiceResult;
import kr.or.ddit.vo.crud.NoticeVO;

public interface INoticeService {

	public ServiceResult insertNotice(NoticeVO noticeVO);

	public NoticeVO selectNotice(int boNo);

}
//NoticeServiceImpl


package kr.or.ddit.service.impl;

import javax.inject.Inject;

import org.springframework.stereotype.Service;

import kr.or.ddit.ServiceResult;
import kr.or.ddit.mapper.INoticeMapper;
import kr.or.ddit.service.INoticeService;
import kr.or.ddit.vo.crud.NoticeVO;
@Service
public class NoticeServiceImpl implements INoticeService {

	@Inject
	private INoticeMapper noticeMapper;
	
	@Override
	public ServiceResult insertNotice(NoticeVO noticeVO) {
		ServiceResult result = null;
		int status = noticeMapper.insertNotice(noticeVO);
		if(status > 0) { //등록 성공
			result=ServiceResult.OK;
			
		}else { //등록 실패
			result = ServiceResult.FAILED;
		}
		return result;
	}

	@Override
	public NoticeVO selectNotice(int boNo) {
		noticeMapper.incrementHit(boNo);
		return noticeMapper.selectNotice(boNo);
	}

}
//INoticeMapper.java

package kr.or.ddit.mapper;

import kr.or.ddit.vo.crud.NoticeVO;

public interface INoticeMapper {
	public int insertNotice(NoticeVO noticeVO);

	public void incrementHit(int boNo);

	public NoticeVO selectNotice(int boNo);
}
//noticeboardMapper_SQL.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="kr.or.ddit.mapper.INoticeMapper">
  	<insert id="insertNotice" parameterType="noticeVO" useGeneratedKeys="true">
  	<selectKey keyProperty="boNo" resultType="int" order="BEFORE">
  		select seq_notice.nextval from dual
  	</selectKey>
  		insert into notice(
  		 bo_no, bo_title, bo_content, bo_writer, bo_date	
  		)values(
  			#{boNo}, #{boTitle}, #{boContent}, #{boWriter}, sysdate
  		)
  		
  		
  	</insert>
  	
  	
  	<update id="incrementHit" parameterType="int">
  		update notice
  		set
  			bo_hit = bo_hit + 1
  		where bo_no = #{bo_no}
  		
  		
  	</update>
  	<select id="selectNotice" parameterType="int" resultType="noticeVO">
  		select 
  			bo_no, bo_title, bo_content, bo_writer, bo_date, bo_hit
  		from notice
  		where bo_no = #{boNo}
  	</select>
    
    <update id="updateNotice" parameterType="noticeVO">
  		update notice
  		set 
  			bo_title = #{boTitle},
  			bo_content = #{boContent},
  			bo_date = sysdate
  		where bo_no = #{boNo}
  	</update>
  	
  </mapper>

mybatisAlias.xml에

 <typeAlias type="kr.or.ddit.vo.crud.NoticeVO" alias="noticeVO"/> 추가

 

 

'대덕인재개발원 > Spring' 카테고리의 다른 글

svn설정  (0) 2024.06.10
인터셉터  (0) 2024.06.05
0604 트랜잭션  (0) 2024.06.04
ckeditor 업로드  (0) 2024.05.28
0514 스프링2 환경설정  (0) 2024.05.14

+ Recent posts