본문 바로가기

전체 글

20240227 스프링(공지 게시판) 내일 할 것. *공지 게시판 notice NoticeController NoticeService>2 NoticeServiceImpl NoticeDAO NoticeDTO >1 notice-mapper.xml *dto에 들어갈 내용 >1 int nno,ndel,nlike,nread String ntitle,ncontent,ndate *DB >2 table name : notice column: nno(int, auto,PK),ndel(int1, 기본1), nread(int,기본1), nlike(int, 기본1),ntitle(VARCHAR 50),ncontent( VARCHAR 500), ndate(datetime, current timestamp) NoticeSerive에 들어갈 추상메소드 >3 일단 서비스.. 더보기
20240226 스프링(갤러리 상세보기(detail), 갤러리 컨트롤러/서비스 상속만들기 , 공지게시판) 요구사항 확인-> 클라이언트 요구사항 받아서 갤러리 수정 등 갤러리 폴라로이드 형식으로 보이게 바꾸기 gallery.jsp > 위에 사진처럼 그리드 형식으로 나오게 변경하기, 부트스트랩 이용해서 만들었다. ${row.gtitle} ${row.glike} | 날짜: ${row.gdate} 글쓰기 게시판으로 gallery-mapper.xml 수정 SELECT gno, gtitle, gfile, if( date_format(now(), '%Y-%m-%d') = date_format(gdate, '%Y-%m-%d'), date_format(gdate, '%h:%i'), date_format(gdate, '%Y-%m-%d')) as gdate, glike FROM gallery WHERE gdel=1 ORDER .. 더보기
20240223 스프링(파일 체크, 파일 업로드 , 갤러리 만들기) public String fileUpload(MultipartFile upFile) { //경로 저장 String root = req().getSession().getServletContext().getRealPath("/"); String upfilePath = root + "resources\\upfile\\"; //UUID UUID uuid = UUID.randomUUID(); //uuid를 포함한 파일명 String newFileName = uuid.toString()+ upFile.getOriginalFilename(); //실제 업로드 File file = new File(upfilePath, newFileName); try { upFile.transferTo(fi.. 더보기
2024.02.27 myboard- board 패키지 파일> controller, dao, dto, service controller 패키지> BoardController // 일단 컨트롤러 만들어주고, 나중에 만들어도 된다. 어노테이션 만들기 @controller = 컨트롤러로 만들기 @Service = 서비스로 만들기 @Repository = DAO @Component = 그 외 객체로 만들기 *데이터 흐름* controller > service > repository > mybatis > DB 흐름제어 > 로직 > DAO 1.Controller(흐름제어) HttpServletRequest, HttpServletResponse를 거의 사용할 필요 없이 필요한 기능 구현 다양한 타입의 파라미터 처리, 다양한 티입의 리턴 타입 사용 가능 GET방식,.. 더보기
2024.02.22 myboard- 설치 및 환경설정 1. STS3설치 Spring Tools4 > Projects > Spring Tools4 >맨 아래 Spring Tool Sutie 3 wiki https://spring.io/ Spring | Home Cloud Your code, any cloud—we’ve got you covered. Connect and scale your services, whatever your platform. spring.io Sping Tool Suite 3.9.18 다운> 압축풀기> C드라이브> sts-bundle> sts-3.9.18.RELEASE >STS.exe 워크스페이스 설정 2.환경설정 한글설정 : workspace, html, css, jsp : UTF-8 Window > Preferences > Gene.. 더보기
20240222 스프링(요구사항 확인-읽음 수 올리기,파일업로드, 디비 암호화) BoardService.java > detail 수정 // 2024.02.16 public BoardDTO detail(int no) { // 파라미터에 따라 아래 값이 달라지니까 보드컨트롤러에서 reNo를 써도 여기서 no로 쓰면 된다. // 문자? util에 숫자로 변경해주는 메소드 만들기 //2024.02.22 psd 요구사항 확인 //로그인 했어?-? 읽음 수 올리기 if(util.getSession().getAttribute("mid") != null) { //DTO 객체 만들기 = 번호 +아이디 BoardDTO dto = new BoardDTO; dto.setBoard_no(no); dto.setMid((String) util.getSession().getAttribute("mid")); bo.. 더보기
20240221 스프링(로그인-글쓰기 버튼, 댓글쓰기, 수정,삭제, ip) // 글쓰기 2024-02-16, 2024.02.21 @PostMapping("/write") // 내용, 제목 받아서 -> db 저장 -> 보드로 이동 // public String write(@Param("title") String title, @Param("content") String content) { // 02.20 로그인관련 request 추가 public String write(WriteDTO dto) { //로그인 검사하기 // System.out.println(dto.getTitle()); // System.out.println(dto.getContent()); if(util.getSession().getAttribute("mid") != null) { int result = board.. 더보기
20240221 스프링(글쓰기, 댓글쓰기 ip, 엔터키처리) Util.java >HttpServletRequest 추가 //2024.02.21 psd 웹표준 public HttpServletRequest req() { ServletRequestAttributes sra = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes(); HttpServletRequest request = sra.getRequest(); return request; } Spring 프레임워크에서 HttpServletRequest 객체를 얻는 메서드 현재 요청과 관련된 HttpServletRequest 객체를 반환한다. 보통 Spring 기반의 웹 애플리케이션에서는 HTTP 요청과 관련된 정보가 필요할 때가 많은데.. 더보기