Navigation

    EDU LEVEL DEVTH IDE FORUM
    USERNAME
    내 정보 수정 쿠폰 관리
  • 로그아웃
    • Search
    • Categories
    • Recent
    • Popular
    • Tags
    1. Home
    2. 권종원
    3. Posts
    • Profile
    • Following
    • Followers
    • Topics
    • Posts
    • Best
    • Groups

    Posts made by 권종원

    • Spring boot jsp 파일 경로 설정 하는방법

      안녕하세요 구름 IDE 로 Spring boot 공부하는 사람입니다..

      view 에 jsp 파일을 생성하여 보여주고 싶은데 경로 설정이 잘 안되서 404 에러가 뜹니다.

      코드 한번 보시고 고쳐야 할 부분 알려주시면 감사하겠습니다 🙂

      부탁드립니다..! 1주일정도 찾아보고 해봤는데 안되네요...
      pom.xml

      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
          <modelVersion>4.0.0</modelVersion>
          <groupId>io.goorm</groupId>
          <artifactId>example</artifactId>
          <version>0.0.1</version>
          <packaging>jar</packaging>
          <name>sample-springboot</name>
          <description>Example project for Spring Boot</description>
      
          <parent>
              <groupId>org.springframework.boot</groupId>
              <artifactId>spring-boot-starter-parent</artifactId>
              <version>2.0.1.RELEASE</version>
              <relativePath/>
          </parent>
      
          <properties>
              <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
              <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
              <java.version>1.8</java.version>
          </properties>
      
          <dependencies>
              <!-- 
                  spring-boot-starter 관련 라이브러리에 대한 설명은 아래의 URL를 참고해주세요.
                  For a description of the spring-boot-starter related library, please refer to the following URL.
                  spring-boot-starter関連ライブラリについては、次のURLを参照してください。
      
                  https://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#using-boot-starter 
              -->
      
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-web</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-test</artifactId>
                  <scope>test</scope>
              </dependency>
              
              <dependency>
                  <groupId>javax.servlet</groupId>
                  <artifactId>jstl</artifactId>
              </dependency>
              <!-- Web 
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-data-rest</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-hateoas</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-jersey</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-web-services</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-webflux</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-websocket</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.springframework.data</groupId>
                  <artifactId>spring-data-rest-hal-browser</artifactId>
              </dependency>
              <dependency>
                  <groupId>io.projectreactor</groupId>
                  <artifactId>reactor-test</artifactId>
                  <scope>test</scope>
              </dependency>
              <dependency>
                  <groupId>org.springframework.restdocs</groupId>
                  <artifactId>spring-restdocs-mockmvc</artifactId>
                  <scope>test</scope>
              </dependency>
              -->
              <!--
      
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-aop</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-cache</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-security</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-validation</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.springframework.retry</groupId>
                  <artifactId>spring-retry</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.springframework.session</groupId>
                  <artifactId>spring-session-core</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-devtools</artifactId>
                  <scope>runtime</scope>
              </dependency>
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-configuration-processor</artifactId>
                  <optional>true</optional>
              </dependency>
              <dependency>
                  <groupId>org.springframework.security</groupId>
                  <artifactId>spring-security-test</artifactId>
                  <scope>test</scope>
              </dependency>
              -->
              
              <!-- SQL 
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-data-jpa</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-jdbc</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.mybatis.spring.boot</groupId>
                  <artifactId>mybatis-spring-boot-starter</artifactId>
                  <version>1.3.2</version>
              </dependency>
              <dependency>
                  <groupId>com.h2database</groupId>
                  <artifactId>h2</artifactId>
                  <scope>runtime</scope>
              </dependency>
              <dependency>
                  <groupId>com.microsoft.sqlserver</groupId>
                  <artifactId>mssql-jdbc</artifactId>
                  <scope>runtime</scope>
              </dependency>
              <dependency>
                  <groupId>mysql</groupId>
                  <artifactId>mysql-connector-java</artifactId>
                  <scope>runtime</scope>
              </dependency>
              <dependency>
                  <groupId>org.hsqldb</groupId>
                  <artifactId>hsqldb</artifactId>
                  <scope>runtime</scope>
              </dependency>
              <dependency>
                  <groupId>org.postgresql</groupId>
                  <artifactId>postgresql</artifactId>
                  <scope>runtime</scope>
              </dependency>
              -->
      
              <!-- NoSQL
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-data-mongodb</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-data-mongodb-reactive</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-data-redis</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-data-redis-reactive</artifactId>
              </dependency>
              -->
      
              <!-- Integration
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-amqp</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.springframework.boot</groupId>
                  <artifactId>spring-boot-starter-integration</artifactId>
              </dependency>
              <dependency>
                  <groupId>org.apache.kafka</groupId>
                  <artifactId>kafka-streams</artifactId>
                  <version>1.0.1</version>
              </dependency>
              <dependency>
                  <groupId>org.springframework.kafka</groupId>
                  <artifactId>spring-kafka</artifactId>
              </dependency>
              -->
          </dependencies>
      
          <build>
              <plugins>
                  <plugin>
                      <groupId>org.springframework.boot</groupId>
                      <artifactId>spring-boot-maven-plugin</artifactId>
                  </plugin>
              </plugins>
          </build>
      </project>
      

      Main_Controller.java

      package project.controllers;
      
      import org.springframework.web.bind.annotation.RequestMapping;
      import org.springframework.stereotype.Controller;
      import org.springframework.web.servlet.ModelAndView;
      
      @Controller
      public class Main_Controller {
          
      	@RequestMapping(value = "/")
          public String home(){
              System.out.println("home method 들어옴!");
              
              return "index";
          }
      }
      

      index.jsp

      <%@ page contentType = "text/html;charset=utf-8" %>
      <%	
      %>
      <!DOCTYPE HTML>
      <html>
      <head>
          <title>Test</title>
      </head>
      <body>
          Test
      </body>
      </html>
      

      application.properties

      server.port=${PORT:8080}
      spring.mvc.view.prefix=/WEB-INF/view/
      spring.mvc.view.suffix=.jsp
      

      파일 경로
      d1.PNG

      posted in 구름EDU 관련 질문
      권종원
    • 1 / 1
    goorm
    상호 : (주)구름    대표 : 류성태    개인정보보호책임자 : 김현화
    경기 성남시 분당구 판교로 242 PDC A동 902호
    사업자등록번호 : 124-87-39200
    통신판매업신고번호 : 제2019-성남분당B-0224호
    TEL : 031-600-8586    Email : contact@goorm.io
    • 구름EDU
    • 구름LEVEL
    • 구름DEVTH
    • 구름IDE
    • 구름FORUM
    ⓒ goorm Inc. All Rights Reserved.
    채용 이용약관 개인정보처리방침 도움말 powered by nodeBB