조건문 조건이 참 일때 화면에 보여주고, 거짓일 때 감출 수 있다. 삼항연산자 switch 반복문 반복문2 - index값 얻기
Thymeleaf 기본문법
·
Framework/SPRING BOOT
${} 로 model 에서 값 가져오기 session에 저장 application scope 사용 @Autowired ServletContext application; DTO에 저장된 값 가져오기
Thymeleaf
·
Framework/SPRING BOOT
Thymeleaf 란? http://www.thymeleaf.org Thymeleaf Integrations galore Eclipse, IntelliJ IDEA, Spring, Play, even the up-and-coming Model-View-Controller API for Java EE 8. Write Thymeleaf in your favourite tools, using your favourite web-development framework. Check out our Ecosystem to see more integrati www.thymeleaf.org 템플릿 엔진 (Template Engine)의 일종 이다. 그렇다면 템플릿 엔진이란 무엇일까? 템플릿 엔진은 템플릿 양식과 특정 데이터..
@PathVariable
·
Framework/SPRING BOOT
http://localhost:8090/app/swagger-ui.html SOAP과 다르게 REST 방식에서는 요청 URL에 어떤 작업할지 내포가 안되기 때문에 method를 통해서 무슨 작업인지를 알려주게 된다. 예> http://localhost:8090/app/name/hong/age/20 값을 얻기 위해서 사용하는게 @PathVariable 어노테이션이고 위 URI에서 20 부분이 @PathVariable로 처리해줄 수 있는 부분이다. 사용법 @GetMapping(" /{변수명}")에 => 꼭 Get이 아니어도 된다. 상관없음. 위에 쓴 변수명을 그대로 @PathVariable("변수명") GET POST & 여러개인 경우 PUT DELETE
Restful 서비스 ( REST 방식 이용한 웹 개발 )
·
Framework/SPRING BOOT
웹 어플리케이션을 개발하는 방식 2가지 1️⃣ SOAP ( Service Oriented Application Programming ) 전통적인 개발 방식 요청: GET방식 : 조회용 ( select ) ⇒ @GetMapping POST방식 : 수정용 (insert, delete, update ) ⇒ @PostMapping 응답: html / jsp ⇒ 웹 브라우저가 필요 ⇒ 화면이 필요 (일반 유저가 보는) 서버에 데이터 전달 방법: query string 예> http://localhost:8090/app/addMember?name=hong&age=20 SOAP은 서로 다른 언어의 플랫폼에서 빌드된 어플리케이션이 서로 통신할 수 있도록 설꼐된 최초의 표준 프로토콜이다. SOAP의 장점은 기존의 원격 ..
@Value
·
Framework/SPRING BOOT
application.properties 에 저장된 key=value 를 빈에서 접근이 가능하다. @Value("${server.port}")
springboot에서 설정 정보 파일
·
Framework/SPRING BOOT
application.properties ( 기본 ) 문법: key=value 예) server.port=8090 application.yml 문법: key: value 예) server: port: 8090
HandlerInterceptor
·
Framework/SPRING BOOT
브라우저 → 필터(Filter) → DispatcherServlet → 인터셉터(preHandle) → Controller | 위임 ← 인터셉터(postHandle) ← ← 인터셉터(afterCompletion) jsp 스프링 프레임워크 의존성 추가 없음 @Component(”xxx”) public class MyHandlerInterceptor extends HandlerInterceptorAdapter {} 필요한 메서드 재정의해서 사용 servlet-context.xml 스프링 부트 의존성 추가 없음 @Component(”xxx”) public class MyHandlerInterceptor implements HandlerInterceptor {} ⇒ 필요한 메서드 재정의해서 사용 왜? defau..
file upload
·
Framework/SPRING BOOT
스프링 프레임워크 1. 2개의 의존성 설정 필요 commons-fileupload, connons-io 2. jsp comment: file: 3. DTO public class UploadDTO { String theText; MultipartFile theFile; 4. servlet-context.xml 5. Controller @PostMapping("/upload") public String upload(UploadDTO dto) { String theText = dto.getTheText(); CommonsMultipartFile theFile = dto.getTheFile(); String originalFilename = theFile.getOriginalFilename(); File f ..