일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 코로나 데이터
- 동행복권 분석
- 로또 통계
- 삼프로
- 로또 균등분포
- 로또 빅데이터
- 포켓몬고 타입 별 분석
- 코로나 통계
- 코로나 통계 분석
- 2020-03-21 로또
- 로또 중앙값
- 포켓몬고 배틀 데이터 분석
- 긍정적인 마음가짐
- 공모전
- 포켓몬고 데이터 분석 활용
- 데이터 공모전
- 빅데이터 공모전
- 포켓몬고 데이터 분석
- 코로나 심각 분석
- 코로나 예측
- 로또 통계 분석
- 코로나 분석
- 포켓몬고 그림자 포켓몬 사용법
- 로또 분석
- 대한민국 코로나 통계 분석
- 코로나 데이터 분석
- 코로나 종식율
- 스펙
- 코로나 심각
- 포켓몬고 배틀 공략
Archives
- Today
- Total
통계 & 데이터 그리고 이야기
com.ja.freeboard.board.controller_BoardController1 본문
728x90
반응형
SMALL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | package com.ja.freeboard.board.controller; import java.io.File; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Map; import java.util.UUID; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.multipart.MultipartFile; import com.ja.freeboard.board.service.BoardServiceImpl; import com.ja.freeboard.vo.BoardVo; import com.ja.freeboard.vo.MemberVo; import com.ja.freeboard.vo.UploadFileVo; @Controller @RequestMapping("/board/*") public class BoardController { @Autowired private BoardServiceImpl boardService; @RequestMapping("/main_page.do") public String mainPage(Model model , String search_word , @RequestParam(value = "currPage" , required = false , defaultValue = "1") int currPage) { List<Map<String,Object>> list = boardService.getBoardList(search_word,currPage); int totalCount = boardService.getBoardDataCount(search_word); //%5 + 1 * 5 //int beginPage = ((currPage-1)/5)*5 + 1; //int endPage = ((currPage-1)/5 + 1)*(5); int beginPage = ((currPage-1)/5)*5 + 1; int endPage = ((currPage-1)/5 + 1)*(5); if (endPage > ((totalCount-1)/10) + 1) { endPage = ((totalCount-1)/10) + 1; } model.addAttribute("beginPage",beginPage); model.addAttribute("endPage",endPage); model.addAttribute("currPage",currPage); model.addAttribute("totalCount",totalCount); model.addAttribute("dataList",list); return "board/main_page"; } @RequestMapping("/write_content_page.do") public String writeContentPage() { return "board/write_content_page"; } @RequestMapping("/write_content_process.do") public String writeContentProcess(MultipartFile [] upload_files ,BoardVo boardVo , HttpSession session) { String uploadRootFolderName = "C:/upload/"; Date today = new Date(); SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd"); String todayFolder = df.format(today); String saveFolderName = uploadRootFolderName + todayFolder; File saveFolder = new File(saveFolderName); if(!saveFolder.exists()) { saveFolder.mkdirs(); } List<UploadFileVo> fileVoList = new ArrayList<UploadFileVo>(); //파일 업로드.. 부분... for(MultipartFile file : upload_files) { //예외 처리... if(file.getSize() <= 0) { continue; } //랜덤 이름 짓기....(중복 배제) //랜덤 + 시간 String oriFileName = file.getOriginalFilename(); String saveFileName = UUID.randomUUID().toString(); saveFileName += "_" + System.currentTimeMillis(); saveFileName += oriFileName.substring(oriFileName.lastIndexOf(".")); String saveRealPath = saveFolderName + "/" + saveFileName; try { file.transferTo(new File(saveRealPath)); }catch(Exception e) { e.printStackTrace(); } //DB를 위한 FileVo객체 생성 UploadFileVo fileVo = new UploadFileVo(); fileVo.setFile_link_path(todayFolder + "/" + saveFileName); fileVo.setFile_real_path(saveRealPath); fileVoList.add(fileVo); } //데이터 처리... MemberVo memberVo = (MemberVo)session.getAttribute("sessionUser"); boardVo.setMember_no(memberVo.getMember_no()); boardService.writeContent(boardVo,fileVoList); return "redirect:./main_page.do"; } @RequestMapping("/read_content_page.do") public String readContentPage(int board_no,Model model) { Map<String,Object> map = boardService.getBoard(board_no); model.addAttribute("aaaa",map); return "board/read_content_page"; } @RequestMapping("/delete_content_process.do") public String deleteContent(int board_no) { boardService.deleteContent(board_no); return "redirect:/board/main_page.do"; } @RequestMapping("/update_content_page.do") public String updateContentPage(int board_no , Model model) { model.addAttribute("data", boardService.getBoard(board_no)); return "board/update_content_page"; } @RequestMapping("/update_content_process.do") public String updateContentProcess(BoardVo vo) { boardService.updateContent(vo); return "redirect:/board/main_page.do"; } } | cs |
728x90
'SpringFramework' 카테고리의 다른 글
main_page.jsp (0) | 2020.05.27 |
---|---|
read_content_page.jsp (0) | 2020.05.27 |
com.ja.freeboard.vo_BoardVo (0) | 2020.05.19 |
com.ja.freeboard.vo_AuthVo.java (0) | 2020.05.19 |
com.ja.freeboard.util_FBMessageDigest.java (0) | 2020.05.19 |
Comments