[TCO] 공지사항

공지사항

  • 검색 페이징 기능

  • CKEDITOR 사용

  • 내 글이 아닌경우 조회만

  • 내 글이면 수정삭제 가능


  • 공지사항 작성


코드

  • mapper.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.tco.notice.mapper.NoticeMapper">

<!-- 메인화면 공지사항 -->
	<select id="mainnotice" resultType="brdVO">
	SELECT T.RNUM, T.BRD_TTL, T.EMP_ID, T.BRD_DT, T.BRD_VI, T.BRD_ID, T.BRD_SE
		FROM (
		    SELECT ROW_NUMBER() OVER (ORDER BY BRD_DT DESC) RNUM, BRD_TTL, EMP_ID, BRD_DT, BRD_VI, BRD_ID, BRD_SE
		    FROM   BRD 
	        WHERE  BRD_SE = '공지')T
	</select>



<!-- 리스트 출력  -->
	<select id="noticelist" resultType="brdVO">
		SELECT T.RNUM, T.BRD_TTL, T.EMP_ID, T.BRD_DT, T.BRD_VI, T.BRD_ID, T.BRD_SE
		FROM (
		    SELECT ROW_NUMBER() OVER (ORDER BY BRD_DT DESC) RNUM, BRD_TTL, EMP_ID, BRD_DT, BRD_VI, BRD_ID, BRD_SE
		    FROM   BRD 
	        WHERE  BRD_SE = '공지'
		   <if test="keyWord!=null and keyWord!=''">
			    AND    (BRD_TTL LIKE '%'||#{keyWord}||'%')
			    
		  </if>
		) T
	
		WHERE T.RNUM BETWEEN #{currentPage}*#{size}-#{size}+1 AND #{currentPage}*#{size}
	</select>

	<select id="selectCount" parameterType="hashMap" resultType="int">
		SELECT COUNT(*)
		FROM   BRD
		WHERE  1 = 1
	   <if test="keyWord!=null and keyWord!=''">
		AND    (BRD_TTL LIKE '%'||#{keyWord}||'%')	    
	   </if>
	   AND BRD_SE = '공지'
	</select>
	
	<!-- 이름 찾기 -->
	<select id="selectname" parameterType="String" resultType="string">
	SELECT EMP_NM
	  FROM EMP
	  WHERE EMP_ID = #{empId}
	</select>
	
	<!-- 공지사항 상세보기  -->
	<select id="noticedetail" resultType="brdVO" parameterType="int">
	 SELECT BRD_TTL,EMP_ID, BRD_CN, BRD_DT, BRD_VI, BRD_IMG, BRD_ID
        FROM BRD
       WHERE BRD_SE = '공지'
         AND BRD_ID =#{brdId}
	</select>
	
	<!-- 공지사항 상세보기 클릭시 조회수 올려~  -->
	<update id="noticevi" parameterType="int">
		 UPDATE BRD 
		 SET BRD_VI = BRD_VI+1 
		 WHERE BRD_ID=#{brdId}
	</update>
	
	<insert id="noticeinsert" parameterType="brdVO">
			<selectKey order="BEFORE" keyProperty="brdId" resultType="brdVO">
				 SELECT NVL(MAX(BRD_ID),0)+1 AS brdId
					FROM BRD
			</selectKey>
			
			INSERT INTO BRD(BRD_ID, BRD_SE,  BRD_TTL, BRD_CN, EMP_ID,
	      					 BRD_DT,  BRD_VI)
			VALUES(#{brdId},'공지',#{brdTtl},#{brdCn}, #{empId}, SYSDATE , 0)
	</insert>
	
	
		<!-- attach_files 테이블로 첨부파일 insert -->
	<insert id="insertAttachFiles" parameterType="attachFilesVO">
		<selectKey order="BEFORE" keyProperty="atchfileId" resultType="Integer">
			SELECT NVL(MAX(ATCHFILE_ID),0)+1 FROM ATCHFILE
		</selectKey>			
		
		INSERT INTO ATCHFILE (ATCHFILE_ID, ATCHFILE_NM, ATCHFILE_SZ, ATCHFILE_DT ) 
		VALUES (#{atchfileId}, #{atchfileNm}, #{atchfileSz}, SYSDATE)		
	</insert>
	
	
	<!-- 글 내용 수정  -->
	<update id="noticeupdate" parameterType="brdVO">
		UPDATE BRD 
		   SET BRD_TTL = #{brdTtl},
		       BRD_CN = #{brdCn}
		 WHERE BRD_ID = #{brdId}
	</update>
	
	<!-- 글 삭제  -->
	<delete id="noticedelete" parameterType="String">
		DELETE FROM BRD
		WHERE BRD_ID = #{brdId}
	</delete>
</mapper>
  • Controller

@RequestMapping("/notice")
@Controller
public class NoticeController {
	private static final Logger logger = 
			LoggerFactory.getLogger(NoticeController.class);
	
	@Autowired
	NoticeService noticeService;
	
	@GetMapping("/noticelist")
	public String noticelist(Model model, @RequestParam(defaultValue="1") int currentPage
			, @RequestParam(required=false) String keyWord
			, @RequestParam(defaultValue="5",required=false) int size, @RequestParam Map<String,Object> map) {
		
		map.put("keyWord", keyWord);
		map.put("currentPage", currentPage);
		map.put("size", size);
		
		// 글 목록
		List<BrdVO> list = noticeService.noticelist(map);
		// 작성자 이름값 넣어주기
		for(BrdVO brdVO : list) {
			String name = noticeService.selectname(brdVO.getEmpId());
			brdVO.setEmpNm(name);
		}
		
		int total = noticeService.selectCount(map);
		
		model.addAttribute("list", new ArticlePage(total, currentPage, size, 5, list));
				
		model.addAttribute("total", total);
		
		logger.info("list를 뽑아보아요옹: "+ list);
		model.addAttribute("data", list);
		
		
		return "notice/noticelist";
	}
	
	@GetMapping("/noticedetail")
	public String noticedetail(@RequestParam int brdId, Model model, HttpServletRequest request) {
		HttpSession session = request.getSession();
		String userId = (String) session.getAttribute("userID");
		
		BrdVO brdVO = new BrdVO();
		brdVO = noticeService.noticedetail(brdId);
		
		String name = noticeService.selectname(brdVO.getEmpId());
		brdVO.setEmpNm(name);
		
		logger.info("brdVO.getEmpId():  "+ brdVO.getEmpId());
		logger.info("userID:    "+ userId);
		logger.info("brdId:    "+ brdId);
		
		
			noticeService.noticevi(brdId);
		
		logger.info("brdVO요기릉 보슈: "+ brdVO.toString());
		model.addAttribute("list", brdVO);
		model.addAttribute("userId", userId);
		
		return "notice/noticedetail";
	}
	
	@GetMapping("/noticeinsert")
	public String noticeinsert(Model model) {
		
		model.addAttribute("brdVO", new BrdVO());
		
		return "notice/noticeinsert";
	}
	
	/*
	 * @PostMapping("/noticeinsert") public String pnoticeinsert(BrdVO brdVO,
	 * HttpServletRequest request) { HttpSession session = request.getSession();
	 * String empId = (String) session.getAttribute("userID"); logger.info("유저아이디는"
	 * + empId); logger.info("noticeVo는: "+ brdVO.toString());
	 * brdVO.setEmpId(empId);
	 * 
	 * //업로드한 파일 MultipartFile[] uploadFile = brdVO.getUploadFile();
	 * 
	 * //파일 저장 경로 설정 String uploadFolder =
	 * "D:\\A_TeachingMaterial\\6.JspSpring\\workspace\\TCO\\src\\main\\webapp\\resources\\upload";
	 * 
	 * //연/월/일 폴더 생성 시작------- File uploadPath = new File(uploadFolder,
	 * getFolder()); logger.info("uploadPath : " + uploadPath);
	 * 
	 * if(uploadPath.exists()==false) {//해당 경로가 없으면 생성해줘야함 uploadPath.mkdirs(); }
	 * 
	 * AttachFilesVO vo = new AttachFilesVO();
	 * 
	 * 
	 * //이미지 3개를 업로드 한다면 3회 반복 for(MultipartFile multipartFile : uploadFile) {
	 * logger.info("-----------"); logger.info("파일명 : " +
	 * multipartFile.getOriginalFilename()); logger.info("파일크기 : " +
	 * multipartFile.getSize());
	 * 
	 * //각 파일 별로 세팅할 VO
	 * 
	 * 
	 * //1) 파일id(기본키데이터), 파일시퀀스번호,파일명과 크기를 세팅
	 * 
	 * vo.setAtchfileSz(""+multipartFile.getSize()); vo.setAtchfileNm(
	 * multipartFile.getOriginalFilename());
	 * 
	 * 
	 * 
	 * //-----------UUID 파일명 처리 시작 ---------------------------- //동일한 이름으로 업로드되면 기존
	 * 파일을 지우게 되므로 이를 방지하기 위함 UUID uuid = UUID.randomUUID();
	 * 
	 * String uploadFileName = uuid.toString() + "-" +
	 * multipartFile.getOriginalFilename(); // c:\\upload\\gongu03.jpg으로 조립 // 이렇게
	 * 업로드 하겠다라고 설계 uploadFolder -> uploadPath //
	 * /resources/upload/2022/02/21/asdfsadfsdafsda_test.jpg
	 * vo.setUploadFileName("/resources/upload/" + getFolder() + "/" +
	 * uploadFileName);
	 * 
	 * brdVO.setBrdImg("/resources/upload/" + getFolder() + "/" + uploadFileName);
	 * 
	 * File saveFile = new File(uploadPath,uploadFileName); //-----------UUID 파일명 처리
	 * 끝 ----------------------------
	 * 
	 * try { //transferTo() : 물리적으로 파일 업로드가 됨 multipartFile.transferTo(saveFile);
	 * 
	 * 
	 * 
	 * 
	 * }catch(Exception e){ logger.info(e.getMessage()); }//end catch }
	 * 
	 * //attach_files 테이블로 insert noticeService.insertAttachFiles(vo);
	 * 
	 * int intresult = noticeService.noticeinsert(brdVO);
	 * 
	 * if(intresult>0) { //고객 등록 성공
	 * 
	 * // 목록으로 이동 return "redirect:/notice/noticelist";
	 * 
	 * }else { return "notice/noticeinsert"; }
	 * 
	 * 
	 * 
	 * }
	 */
	
	
	//첨부파일을 보관하는 폴더를 연/월/일 계층 형태로 생성하기 위함
		private String getFolder() {
			SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
			Date date = new Date();
			String str = sdf.format(date);
			return str.replace("-", "/");
		}
		
		@PostMapping("/noticefile")
		@ResponseBody 
		public void ckUpload(Model model, HttpServletRequest req
				, HttpServletResponse res
				, @RequestParam MultipartFile upload) throws Exception { 
			logger.info("ckUpload 진입 =========================================1"); 
			logger.info("multipartfile : " + upload); 
			// 랜덤 문자 생성 
			UUID uid = UUID.randomUUID(); 
			OutputStream out = null; 
			PrintWriter printWriter = null;
			JsonObject json = new JsonObject();
			
			String uploadPathFile ="D:\\A_TeachingMaterial\\6.JspSpring\\workspace\\TCO\\src\\main\\webapp\\resources\\upload";
			File uploadPath = new File(uploadPathFile, getFolder());
			logger.info("uploadPath : " + uploadPath);
			
			if(uploadPath.exists()==false) {//해당 경로가 없으면 생성해줘야함
				uploadPath.mkdirs();			
			}
			
			// 인코딩 
			res.setCharacterEncoding("utf-8"); 
			res.setContentType("text/html;charset=utf-8"); 
			try { 
				String fileName = upload.getOriginalFilename(); 
				String uploadFileName = uid.toString() + "-" + fileName;
				logger.info("uploadFileName : " + uploadFileName);
				// 파일 이름 가져오기 
				byte[] bytes = upload.getBytes(); 
				File saveFile = new File(uploadPath, uploadFileName);
//				File saveFile = new File(uploadPathFile, fileName);
				
				// 업로드 경로 
				out = new FileOutputStream(saveFile); 
				out.write(bytes); 
				out.flush(); 
				// out에 저장된 데이터를 전송하고 초기화
				String callback = req.getParameter("CKEditorFuncNum"); 
				printWriter = res.getWriter(); 
				String fileUrl = "/resources/upload/" + getFolder() + "/" + uid.toString() + "-" + fileName; 
//				String fileUrl = "cid:" + fileName; 
//				String fileUrl = "https://mail.naver.com/read/image/?mailSN=13615&attachIndex=1&contentType=image/jpeg&offset=2185&size=176478&mimeSN=1649325600.325245.23553.5888&org=1&u=qkrwldms1403"; 
				// 작성화면 
				//String fileUrl = "/ckUpload/" + uid + "&fileName=" + fileName; 
				
	            
	            // json 데이터로 등록
	            // {"uploaded" : 1, "fileName" : "test.jpg", "url" : "/img/test.jpg"}
	            // 이런 형태로 리턴이 나가야함.
				json.addProperty("uploaded", 1);
				json.addProperty("fileName", fileName);
				json.addProperty("url", fileUrl);
				
				printWriter.println(json);
	            
	            // 작성화면
	            // 업로드시 메시지 출력 
//	            printWriter.println("<script type='text/javascript'>" + "window.parent.CKEDITOR.tools.callFunction(" + callback+",'"+ fileUrl+"','이미지를 업로드하였습니다.')" +"</script>"); 
//	            printWriter.flush();
	            
			} catch (IOException e) { 
				e.printStackTrace(); 
			} finally { 
				try { 
					if(out != null) { out.close(); } 
					if(printWriter != null) { printWriter.close(); } 
					} 
				catch(IOException e) { e.printStackTrace(); } 
			}
			
			return; 
			
		}
		
		
		@PostMapping("/noticeinsert")
	    public String insert (@ModelAttribute BrdVO brdVO,  HttpSession session) throws Exception{
	      
	       //로그인한 사용자의 아이디를 체크
		  //아이디를 체크해서 자신의 글에만 수정과 삭제가 가능하게 할 예정
			/* String userId = (String) session.getAttribute("userID"); */
	        /*dto.setUser_id(user_id);*/
	        
			/*
			 * insert.setContentType("text/html; charset=UTF-8"); PrintWriter out_write =
			 * insert.getWriter(); logger.info("out_write"+ out_write);
			 * 
			 * out_write.println("<script>alert('글이 작성되었습니다.');</script>");
			 * out_write.flush();
			 */
			 String userId = (String) session.getAttribute("userID");
			brdVO.setEmpId(userId);
			logger.info("brdVO"+brdVO);
	        
	        //레코드를 저장함
	       /* memberboardservice.create(dto);*/
			 noticeService.noticeinsert(brdVO) ;
	        
	        
	        //게시물을 저장한 후에 게시물 목록페이지로 다시 이동함
	        return "redirect:/notice/noticelist";
	        }
		

	  
	  @GetMapping("/noticeupdate")
	  public String noticeupdate(@ModelAttribute BrdVO brdVO, Model model) {
		  logger.info("brdVO1"+ brdVO);
		  brdVO =  noticeService.noticedetail(brdVO.getBrdId());
		  logger.info("brdVO2"+ brdVO);
		  
		  model.addAttribute("list", brdVO);
		  
		  return "notice/noticeupdate";
	  }
	  
	  @PostMapping("/noticeupdate")
	  public String pnoticeupdate(BrdVO brdVO) {
		  logger.info("brdVO~~"+ brdVO);
		  int result = noticeService.noticeupdate(brdVO);
		  
		  if(result>0) {
			  
			  return "redirect:/notice/noticelist";
		  }else {
			  return "notice/noticeupdate";
		  }
	  }
	  
	  @GetMapping("/noticedelete")
	  public String noticedelete(@RequestParam String brdId) {
		  logger.info("brdId???"+ brdId);
		  int result = noticeService.noticedelete(brdId);
		  
		  if(result>0) {
			  return "redirect:/notice/noticelist";
		  }else {
			  return "redirect:/notice/noticelist";
		  }
		  
	  }
		
	
	
	    

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

<script src="/resources/js/jquery-3.6.0.min.js"></script>
<script type="text/javascript">
   function fn_click(){

   }
   
   $(function() {
	   
   })
  
</script>

 <!-- start page title -->
 <div class="row">
     <div class="col-12">
         <div class="page-title-box d-sm-flex align-items-center justify-content-between">
             <h1 class="mb-sm-0 font-size-20">📋공지사항</h1>

             <div class="page-title-right">
                 <ol class="breadcrumb m-0">
                     <li class="breadcrumb-item"><a href="javascript: void(0);">공지사항</a></li>
                     <li class="breadcrumb-item active">공지사항목록</li>
                 </ol>
             </div>

         </div>
     </div>
 </div>
 <!-- end page title -->

 <div class="row">
     <div class="col-12">
         <div class="card">
             <div class="card-body">
                 <div class="row mb-2">
                     <div class="col-sm-4">
                         <div class="search-box me-2 mb-2 d-inline-block">
                             <div class="position-relative">
                        <form name="searchForm" id="searchForm" action="/notice/noticelist" method="get">
                             <div>
                                            <input  class="form-control"  type="search"  name="keyWord" id="keyWord" value="${param.keyWord}" placeholder="글제목" aria-label="Add your item here...">
                                               <!--  제발 submit 해주시궜어요????????? -->
                                            <i class="bx bx-search-alt search-icon"></i>
                              </div>
                              </form>
                             </div>
                         </div>
                     </div>
                     <div class="col-sm-8">
                         <div class="text-sm-end">
                             <a href="/notice/noticeinsert" class="btn btn-success btn-rounded waves-effect waves-light mb-2 me-2"><i class="mdi mdi-plus me-1"></i>글쓰기</a>
                         </div>
                     </div><!-- end col-->
                 </div>
               <!-- Nav tabs -->
               <!--직원조회-->
               <ul class="nav nav-tabs nav-tabs-custom" role="tablist">
                   <li class="nav-item">
                       <a class="nav-link active" data-bs-toggle="tab" href="#cnpt" role="tab">
                           <span class="d-none d-sm-block">글목록</span> 
                       </a>
                   </li>
                   
                  
               </ul>

               <!-- Tab panes -->
               <!-- 직원조회 -->
               <div class="tab-content p-3">
                   <div class="tab-pane active" id="cnpt" role="tabpanel">
                <div class="table">
                                                     <table class="table align-middle table-nowrap table-check">
                                                        <thead class="table-light">
                                                            <tr>
                                                               <th style="width: 20px;" class="align-middle">No</th>
                                                               <th class="align-middle">글제목</th>
                                                               <th class="align-middle">작성자</th>
                                                               <th class="align-middle">작성일</th>
                                                               <th class="align-middle">조회수</th>
                                                            </tr>
                                                            
                                                        </thead>

                                                        <tbody>
                                                         
                                                  <c:forEach items="${data}" var="data"> 
                                                  
                                                  <tr onClick="location.href='/notice/noticedetail?brdId=${data.brdId}'">
<%--                                                   <tr onClick="location.href='/notice/noticedetail?brdId=${data.empId}'"> --%>
                                   <td>
                                   
                                       <div class="form-check font-size-14">
                                           		${data.rnum}
                                      </div>
                                   </td>
                                   <td>
                                       <h5 class="font-size-14 mb-1"><a href="javascript: void(0);" class="text-dark">${data.brdTtl}</a></h5>
                                       <p class="text-muted mb-0">지점</p>
                                   </td>
                                   <td>  
                                   <h5 class="font-size-14 mb-1"><a href="javascript: void(0);" class="text-dark">${data.empNm}</a></h5>
                                   </td>
                                   <td>  
                                   <fmt:formatDate var="brdDt" value="${data.brdDt}" pattern="yyyy-MM-dd"/>
                                   <h5 class="font-size-14 mb-1"><a href="javascript: void(0);" class="text-dark">${brdDt}</a></h5>
                                   </td>
                                   <td>  
                                   <h5 class="font-size-14 mb-1"><a href="javascript: void(0);" class="text-dark">${data.brdVi}</a></h5>
                                   </td>
                                 
                                  
                               </tr>
                                </c:forEach> 
                               
                               
                          
                                                        </tbody>
                                                    </table>
                                                     <!-- 페이징  -->
             <div class="row">
                       <div class="col-lg-12">
                           <ul class="pagination pagination-rounded justify-content-center mt-4">
                               <li class="page-item <c:if test='${list.currentPage<5}'>disabled</c:if>" >
                                   <a href="/notice/noticelist?currentPage=${list.currentPage-4}" class="page-link"><i class="mdi mdi-chevron-left"></i></a>
                               </li>
                               
                               <c:forEach var="pNo" begin="${list.startPage}" end="${list.endPage}" step="1">
                               <li class="page-item <c:if test='${list.currentPage eq pNo}'>active</c:if> " >
                                   <a href="/notice/noticelist?currentPage=${pNo}" class="page-link">${pNo}</a>
                               </li>     
                               </c:forEach> 
                                                   
                               <li class="page-item <c:if test='${list.endPage>=list.totalPages}'>disabled</c:if> "  > 
                                   <a href="/notice/noticelist?currentPage=${list.startPage+5}" class="page-link"><i class="mdi mdi-chevron-right"></i></a>
                               </li>
                           </ul>
                       </div>
                   </div>
                                                </div>
                   
                
                   
                   </div>
                   
                   
                   
               </div>
             </div>
         </div>
         <!-- end card -->
     </div>
 </div>
 <!-- end row -->


        <script src="assets/libs/jquery/jquery.min.js"></script>
        <script src="assets/libs/bootstrap/js/bootstrap.bundle.min.js"></script>
        <script src="assets/libs/metismenu/metisMenu.min.js"></script>
        <script src="assets/libs/simplebar/simplebar.min.js"></script>
        <script src="assets/libs/node-waves/waves.min.js"></script>
        <script src="assets/js/app.js"></script>

  • noticedetail
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
  <script src="assets/libs/jquery/jquery.min.js"></script>
<script>

function del(){
	
	 if(!confirm('삭제하시면 복구할수 없습니다. \n 정말로 삭제하시겠습니까??')){
		
	        return false;
	    }else{
	    	
	    	 alert("삭제되었스믄다.");
	    	location.href="/notice/noticedelete?brdId=${list.brdId}"

	    }
}
</script>

<style>
	.bt{
		float: right;
		margin-right: 50px;
	}
</style>

 <div class="row">
     <div class="col-12">
         <div class="page-title-box d-sm-flex align-items-center justify-content-between">
             <h1 class="mb-sm-0 font-size-20">📋공지사항</h1>

             <div class="page-title-right">
                 <ol class="breadcrumb m-0">
                     <li class="breadcrumb-item"><a href="javascript: void(0);">공지사항</a></li>
                     <li class="breadcrumb-item active">공지사항목록</li>
                 </ol>
             </div>

         </div>
     </div>
 </div>

		
		
<div class="row">
     <div class="col-12">
         <div class="card">
             <div class="card-body">
             	<div>
                 	<h1>${list.brdTtl}</h1><br>
					
			<fmt:formatDate var="brdDt" value="${list.brdDt}" pattern="yyyy-MM-dd"/>
			<b><span>작성일</span></b> ${brdDt} &nbsp;
			<b><span>작성자</span></b> ${list.empNm}  &nbsp;
			<b><span>조회수</span></b> ${list.brdVi}  &nbsp; &nbsp;
			<c:if test="${userId eq list.empId}">
			<a href="/notice/noticeupdate?brdId=${list.brdId}" class="edit" >[수정]</a>
			<a style="cursor:pointer" class="delete" id="dbtn" onclick="del()" >[삭제]</a>
			</c:if>
				

             	</div>
				<br>
				<hr><br>
				${list.brdCn}
				<br>
				<hr><br>
				<button type="button" class="btn btn-primary waves-effect waves-light bt" onClick="location.href='/notice/noticelist'">목록으로</button>
</div></div></div></div>
  • noticeupdate
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript" src="/resources/ckeditor/ckeditor.js"></script>
<style>
.inp{
	width: 100%;
	height: 40px;
	font-size: 20px;
	border:none;
}
</style>

 <div class="row">
     <div class="col-12">
         <div class="page-title-box d-sm-flex align-items-center justify-content-between">
             <h1 class="mb-sm-0 font-size-20">📋공지사항 수정</h1>

             <div class="page-title-right">
                 <ol class="breadcrumb m-0">
                     <li class="breadcrumb-item"><a href="javascript: void(0);">공지사항</a></li>
                     <li class="breadcrumb-item active">공지사항 수정</li>
                 </ol>
             </div>

         </div>
     </div>
 </div>
 
    <div class="form-group row mb-4 m-2">
 	<form method="post" action="/notice/noticeupdate" enctype="multipart/form-data"> 
 	  	<input id="brdId" name="brdId" value="${list.brdId}" hidden="true" />
            <input id="brdTtl" name= "brdTtl" value="${list.brdTtl}" type="text"  class="inp"/>
                	<textarea class="form-control" id="brdCn" name="brdCn" >${list.brdCn}</textarea>
                	<script type="text/javascript">
		        	CKEDITOR.replace('brdCn',{
		    			filebrowserUploadUrl: '/notice/noticefile',
		    			height: 500, 
		    			width: 1550,
		    			resize_enaleb : false,
		  		      		enterMode : CKEDITOR.ENTER_BR,
		  		      		shiftEnterMode : CKEDITOR.ENTER_P
		    			});
        	
			        	/*  var value = CKEDITOR.instances.brdCn.getData();
			        	 alert("value"+value); */
       				 </script>
        
	          	 <div class="text-end">
		          <button type="submit" class="btn btn-primary waves-effect waves-light w-sm" id="ckbtn" name="ckbtn">
		             <i class="mdi mdi-download d-block font-size-10" ></i> 수정완료
		         </button>
				 </div>
		</form>
          
      </div>
                  
  • noticeinsert
<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<script type="text/javascript" src="/resources/ckeditor/ckeditor.js"></script>

<style>
.inp{
	width: 100%;
	height: 40px;
	font-size: 20px;
	border:none;
}
.inp2{
	width: 100%;
	height:auto;
	font-size: 20px;
	border:none;
}

</style>
 <div class="row">
     <div class="col-12">
         &<div class="page-title-box d-sm-flex align-items-center justify-content-between">
             <h1 class="mb-sm-0 font-size-20">📋공지사항 작성</h1>

             <div class="page-title-right">
                 <ol class="breadcrumb m-0">
                     <li class="breadcrumb-item"><a href="javascript: void(0);">공지사항</a></li>
                     <li class="breadcrumb-item active">공지사항작성</li>
                 </ol>
             </div>

         </div>
     </div>
 </div>
 
 <div class="row">
     <div class="col-12">	                                     
	                 <form method="post" action="/notice/noticeinsert" enctype="multipart/form-data"> 
	                                     <div class="form-group row mb-4 m-2">
	                       <input id="brdTtl" name= "brdTtl" type="text" placeholder="제목을 입력하세요" class="inp"/>
                            	<textarea class="form-control" id="brdCn" name="brdCn"></textarea>
                            	<script type="text/javascript">
				                	CKEDITOR.replace('brdCn',{
				            			filebrowserUploadUrl: '/notice/noticefile',
				            			height: 500, 
				            			width: 2000,
				            			resize_enaleb : false,
		            		      		enterMode : CKEDITOR.ENTER_BR,
		            		      		shiftEnterMode : CKEDITOR.ENTER_P
				            		});
				                	
				                	/*  var value = CKEDITOR.instances.brdCn.getData();
				                	 alert("value"+value); */
				                </script>
				                
				                
                            </div>
	            <div class="text-end">
             <!--    <a href="ecommerce-checkout.html" class="btn btn-success">
                    <i class="mdi mdi-truck-fast me-1"></i> Proceed to Shipping </a> -->
                    <button type="submit" class="btn btn-primary waves-effect waves-light w-sm" id="ckbtn" name="ckbtn">
                       <i class="mdi mdi-download d-block font-size-10" ></i> 등록
                   </button>
		        </div>
		        	</form>
	</div>
</div>

좋은 웹페이지 즐겨찾기