오늘의 노래 추천
- 아티스트
- BLACKPINK
- 앨범
- BORN PINK
- 발매일
- 1970.01.01
타이틀, shutdown 다음으로 좋음 이거랑 happiest girl도
DAY 1
ㅡ Spring 환경설정 ㅡ
Build의 자동관리 도구 maven
[ Sprint tool Suite 3 설치 링크 ]
https://github.com/spring-attic/toolsuite-distribution/wiki/Spring-Tool-Suite-3



[ 부록 : 트러블 슈팅! ]
sts.exe 파일을 실행시키려할 때
!! 경로에 한글이 있어서 오류 발생 !!
ㅡ> sts.exe 파일의 위치를 바탕화면에서 c 드라이브로 이동
ㅡ> lombok 경로도 재설정
ㅡ Spring 프로젝트 생성ㅡ
Spring Legacy Project ( Spring MVC Project )


spring MVC Project 선택 후 프로젝트 생성

서버 포트번호 8085로 변경

@Controller
public class HomeController {
private static final Logger logger = LoggerFactory.getLogger(HomeController.class);
@RequestMapping(value = {"/", "home"}, method = RequestMethod.GET)
public ModelAndView home(Locale locale, Model model) {
logger.info("Welcome home! The client locale is {}.", locale);
ModelAndView mav = new ModelAndView("home");
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
String formattedDate = sdf.format(date);
mav.addObject("serverTime", formattedDate );
mav.addObject("title", "스마트 인재 개발원");
return mav;
}
}
ModelAndView 선언
Model에서 정보를 저장하는 상황일때 인코딩 방식이나 세션 정보를 불러와
정보를 빼올 가능성이 생기기 때문에
Object 객체 : 객체의 타입이 필요없음
SimpleDateFormat 을 선언해 시간정보를 불러오고 addObject 메서드를 이용해 저장
ㅡ jsp 기본설정 ㅡ
page, taglib, c:set

<%@ page language="java" contentType = "text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<c:set var="ctx" value="${pageContext.request.contextPath }"/>
JSP의 페이지 디렉티브와 태그 라이브러리( JSTL ) import 문 작성
+ 컨텍스트 경로 설정
ㅡ context path 확인 ㅡ
pageContext.request.contextPath



ㅡ admin(관리자) 페이지 생성 ㅡ
Spring Legacy Project ( Spring MVC Project )

resources 파일 붙여넣고 admin 폴더 생성 후 board.jsp 파일 붙여넣기
ㅡ include 파일 생성 ㅡ
pageContext.request.contextPath

<jsp:include page="include/meta.jsp" />
<jsp:include page="include/common.jsp" />
(중략)
<jsp:include page="include/lib.jsp" />
jsp:include 태그를 활용해 meta, link, script 태그내용 불러오기

각 meta, link, script 태그 안의 src 내용을 contextPath와 연결
ㅡ HomeController 수정 ㅡ
/admin/board

HomeController에서 board.jsp로 갈 수 있는 메서드 생성
@RequestMapping(value = "/admin/board_write", method = RequestMethod.GET)
public ModelAndView boardWrite(Locale locale, Model model) {
logger.info("Welcome home! The client locale is {}.", locale);
ModelAndView mav = new ModelAndView("/admin/board_write");
return mav;
}
같은 방식으로 board_write 파일도 jsp에 붙여넣어주기
(수정중)

BYE
Spring Tool Suite 3
the distribution build for the Spring Tool Suite and the Groovy/Grails Tool Suite - spring-attic/toolsuite-distribution
github.com