상세 컨텐츠

본문 제목

struts 2 설정 파일

Programming/Spring Framework

by otamot 2009. 10. 21. 14:11

본문

struts.properties 설정 파일

struts.i18n.reload= true
struts.devMode = false
#configuration에서 설정된 모든 xml 다시 로딩해해서 무조건 처리해라. 실무에서는 사용 금지!!
struts.configuration.xml.reload = true
struts.continuations.package = org.apache.struts2.showcase
strtus.custom.i18n.resources = globalMessages
#was의 포트 번호, default는 80
struts.url.http.port = 9000
struts.action.extension=do
#struts.freemarker.manager.classname = customFreemarkerManager
struts.serve.static = true
struts.serve.static.browserCache = false
struts.multipart.maxSize = 2097252
#struts.objectFactory = org.apache.struts2.spring.StrutsSpringObjectFactory

WEB-INF/classes 에 존재해야 인식합니다.

● struts.xml 설정 파일

<struts>
    <!-- struts의 ObjectFactory를 Spring에 담을 수 있게 설정. -->
    <constant name="struts.objectFactory" value="org.apache.struts2.spring.StrutsSpringObjectFactory"/>
<package name="default" extends="struts-default">
        <action name="userAction" class="userAction">
            <result>/testUser.jsp</result>
        </action>
    </package>
</struts>

또한 WEB-INF/classes 에 존재해야 인식합니다.

<constant name="struts.objectFactory" value="org.apache.struts2.spring.StrutsSpringObjectFactory"/>

위 부분을 통해서 struts2의 action bean을 spring config파일에 정의 할 수 있게 됩니다.

관련글 더보기