From 9665fc0e2644cc5a153857fcc009b9b43d50727a Mon Sep 17 00:00:00 2001 From: daniel LEE Date: Mon, 23 Oct 2023 23:21:58 +0900 Subject: [PATCH] =?UTF-8?q?JSP=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 10 ++++++++++ .../example/demo/controller/JSPController.java | 17 +++++++++++++++++ .../demo/controller/UserProfileController.java | 3 +-- src/main/resources/application.properties | 10 +++++++++- src/main/webapp/WEB-INF/views/hello.jsp | 12 ++++++++++++ 5 files changed, 49 insertions(+), 3 deletions(-) create mode 100644 src/main/java/com/example/demo/controller/JSPController.java create mode 100644 src/main/webapp/WEB-INF/views/hello.jsp diff --git a/pom.xml b/pom.xml index 82695a7..e407850 100644 --- a/pom.xml +++ b/pom.xml @@ -17,6 +17,16 @@ + + org.apache.tomcat.embed + tomcat-embed-jasper + + + + javax.servlet + jstl + + commons-fileupload diff --git a/src/main/java/com/example/demo/controller/JSPController.java b/src/main/java/com/example/demo/controller/JSPController.java new file mode 100644 index 0000000..fe0a8bf --- /dev/null +++ b/src/main/java/com/example/demo/controller/JSPController.java @@ -0,0 +1,17 @@ +package com.example.demo.controller; + +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; + +@Controller +public class JSPController { + + @GetMapping("/hello") + public String home(Model model) { + System.out.println("home controller start"); + model.addAttribute("name", "나의 이름은 이진기입니다."); + return "hello"; + } + +} diff --git a/src/main/java/com/example/demo/controller/UserProfileController.java b/src/main/java/com/example/demo/controller/UserProfileController.java index d289669..90b6c5e 100644 --- a/src/main/java/com/example/demo/controller/UserProfileController.java +++ b/src/main/java/com/example/demo/controller/UserProfileController.java @@ -4,7 +4,6 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; -import java.util.HashMap; import java.util.List; import java.util.UUID; @@ -23,7 +22,7 @@ import com.example.demo.model.UserProfile; @RestController public class UserProfileController { - + private UserProfileMapper mapper; public UserProfileController(UserProfileMapper mapper) { diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index f83c4d5..6cd362c 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -7,6 +7,7 @@ spring.datasource.password=Ghtkssk0325 server.servlet.encoding.charset=UTF-8 server.servlet.encoding.enabled=true server.servlet.encoding.force=true + # Multipoart spring.servlet.multipart.max-file-size=500MB spring.servlet.multipart.max-request-size=500MB @@ -15,4 +16,11 @@ spring.servlet.multipart.location=${java.io.tmpdir} # Image save folder #server.url.img=/Users/daniellee/Downloads -server.url.img=/usr/local/soft/tomcat/webapps/profile \ No newline at end of file +server.url.img=/usr/local/soft/tomcat/webapps/profile + +# JSP +spring.mvc.view.prefix=/WEB-INF/views/ +spring.mvc.view.suffix=.jsp +spring.mvc.static-path-pattern=/resources/** +#JSP수정시 서버 재시작없이 바로 적용될 수 있게 설정 +server.servlet.jsp.init-parameters.development=true \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/views/hello.jsp b/src/main/webapp/WEB-INF/views/hello.jsp new file mode 100644 index 0000000..4c7f0b2 --- /dev/null +++ b/src/main/webapp/WEB-INF/views/hello.jsp @@ -0,0 +1,12 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> +<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> + + + + +Insert title here + + + ${ name } + + \ No newline at end of file