[spring] 프로젝트 기초 (web.xml을 통한 default 페이지 설정)

2021. 3. 2. 01:31프론트엔드 개발

반응형

처음 Spring 프레임워크를 이용하여 프로젝트를 시작하게 되면 초기 페이지 설정을 어떻게 해야할 지 모르는 경우가 있다(like me ㅠㅠ)

 

그래서 이러한 경우에는 web.xml을 통하여 설정한다는 사실을 알고 있어야 한다

 

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" version="4.0">
  <display-name>Project_withyou</display-name>
  <welcome-file-list>
    <welcome-file>./WEB-INF/views/index.jsp</welcome-file>
  </welcome-file-list>
</web-app>

이와 같이 <welcome-file-list> 안에 <welcome-file>로 default 페이지 경로를 설정해두면 스프링으로 구현한 프로젝트를 빌드하게 되면 위 경로로 바로 들어가진다.

반응형