출처 : Minato님의 노트 (http://minato.springnote.com/pages/4547351)

 

web.xml

  1. <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns:xsi="
    http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  2. <display-name>SF_003_Struts_Configuration</display-name>

  3. <!-- WAS 구동시에 초기 설정값 -->

  4. <context-param>

  5. <param-name>contextConfigLocation</param-name>

  6. <param-value>/WEB-INF/config/spring/applicationContext.xml</param-value>

  7. </context-param>

  8. <listener>

  9. <listener-class>

  10. org.springframework.web.context.ContextLoaderListener

  11. </listener-class>

  12. </listener>

  13. <servlet>

  14. <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>

  15. <param-name>config</param-name>
    <param-value>/WEB-INF/config/struts/struts-config.xml</param-value>

  16. </init-param>

  17. </servlet>

  18. <servlet-mapping>

  19. <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>

  20. </servlet-mapping>

  21. <welcome-file-list>

  22. <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>

  23. </welcome-file-list>

  24. </web-app>

 

 

applicationContext.xml

  1. <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="
    http://www.springframework.org/schema/beans"
     xmlns:xsi="
    http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
  2. <bean id="boardDao" class="kr.co.bit.lecture.board.dao.ibatis.BoardDaoiBATIS"></bean>

  3. <bean id="boardService" class="kr.co.bit.lecture.board.service.spring.BoardServiceSpring">

  4. <property name="boardDao" ref="boardDao" />

  5. </bean>

  6. <bean name="/board/index" class="kr.co.bit.lecture.board.action.IndexAction">

  7. <property name="boardService" ref="boardService" />

  8. </bean>

  9. </beans>

 

 

struts-config.xml

  1. <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC
            "-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
            "
    http://struts.apache.org/dtds/struts-config_1_3.dtd">
  2. <struts-config>
  3. <action-mappings>

  4. <action path="/board/index" type="org.springframework.web.struts.DelegatingActionProxy">

  5. <forward name="index" path="/WEB-INF/views/jsp/board/index.jsp" />

  6. </action>

  7. </action-mappings>

  8.  

  9. <plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">

  10. <set-property property="contextConfigLocation" value="/WEB-INF/config/spring/applicationContext.xml" />

  11. </plug-in>

  12. </struts-config>