상세 컨텐츠

본문 제목

[jsp] index 페이지 .do로 시작하기

헉!!/jsp, java

by 권태성 2012. 9. 10. 09:36

본문

web.xml에 일반적으로 welcome-file에 index.jsp에 대해 아래와 같이 설정합니다.


<welcome-file-list>

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

</welcome-file-list>


하지만 index.jsp가 아닌 스트러츠 액션인 index.do를 사용하기 위해


<welcome-file-list>

<welcome-file>index.do</welcome-flie>

</welcome-file-list>


위와 같이 변경을 하면 동작하지 않습니다. (welcome-file-list 요소내에서는 서블릿 매핑을 사용하지 않기 때문)

그래서 이에 대한 대안으로 사용하는 방법이 여러가지 있겠지만 그 중 한가지가


web.xml은 그대로 index.jsp로 두고 index.jsp 파일 내에서 <jsp:forward page="index.do" /> 로 포워드를 하면 됩니다.

관련글 더보기