STRUTS2 상수설정

프로그래밍/JAVA | 2008. 3. 28. 10:33
Posted by 손반장님
상수는 프레임워크의 작동 방식에 대한 환경 설정 요소입니다.

default.properties

이 파일은 struts2-core-버전.jar 파일의 org.apache.struts2 패키지에 존재하며 모든 환경 설정 기본값이 설정 되어 있습니다. 따라서 설정 파일들을 통해 설정을 변경 하고자 하는 프로퍼티만 변경 하면 됩니다.
설정 항목들에 대해서는 이 파일을 참조하면 됩니다.

struts.properties 에서 설정
이 파일은 default.properties 와 설정 방법이 동일하며 ClassPath 루트에 위치해야 합니다.

struts.xml 에서 설정
<struts>
    <constant name="프로퍼티명" value="프로퍼티값" />
    ......
</struts>

web.xml 에서 설정
<web-app ......>
    <filter>
        <filter-name>struts</filter-name>
        <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    </filter>
    <init-param>
       <param-name>프로퍼티명</param-name>
       <param-value>프로퍼티값</param-value>
    </init-param>
</web-app>

여러 파일에서 환경 설정을 할 수 있듯이 Struts2가 환경 설정 값을 찾는 순서도 있습니다.
나중에 찾는 설정중에 이전의 중복된 설정이 있다면 나중에 찾는 설정이 오버라이드 됩니다.
struts-default.xml -> struts-plugin.xml -> struts.xml -> struts.properties -> web.xml

출처 : http://jjaeko.tistory.com/50
 
블로그 이미지

손반장님

카테고리

분류 전체보기 (68)
잡담 (15)
stuff (6)
Mountain (11)
프로그래밍 (35)