웹/JSP

jsp? main을 설정하는 방법 두가지!

은은하게미친자 2022. 7. 21. 00:04
728x90

1) 소스내에 xml 파일이 있을 경우

 

XML 파일에서 MAIN으로 로딩하는 

파일을 설정할수 있다.

이를 welcome list라 한다.

 

소스적용은 다음과같이한다.

    <welcome-file-list>
        <welcome-file>welcome.jsp</welcome-file>
    </welcome-file-list>

 

2)  \WebContent\index.jsp 만들어주기.

처음 서버가 돌게 되며 실행하는 파일이 index.jsp이기 때문이다. 

index.jsp를 만들어서 forward 태그를 이용하여 원하는 페이지로 이동시켜주면 된다

<jsp:forward page="welcome.jsp"></jsp:forward>

 

 

+

톰캣 서버 파일중 web.xml 파일 을 보면

    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>

 

위와같이 서버의 welcome파일을 index 파일로 설정하는것을 알수있다.

 

 

 

728x90