* controller 부분이 바뀐다.


환경설정 >

1. 사이트 접속  - 다운로드

http://www.apache.org/

  • Struts


  • Apache Struts 2.3.8 GA  다운로드/압축해제


    2. 라이브러리 복사

    압축해제 후 \struts-2.3.4\apps 밑에 struts2-blank.war 압축풀고
    그밑에 \WEB-INF\lib의 라이브러리 복사해서 사용해도 된다.( 이예제 사용을 위해 ) 

    3. WEB-INF 밑에





















    ; classes폴더밑에 xml2개 복사. ( struts2-blank.war에서 )

    ; web.xml은 filter역할. 내용은 struts2-blank.war에서 web.xml내용 복사.

    ; 구성완료.



    (1) web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

        <display-name>Struts Blank</display-name>

        <filter>
            <filter-name>struts2</filter-name>
            <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
        </filter>

        <filter-mapping>
            <filter-name>struts2</filter-name>
            <url-pattern>/-</url-pattern>
        </filter-mapping>

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

    </web-app>


    (2) struts.xml

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
        "http://struts.apache.org/dtds/struts-2.3.dtd">

    <struts>
        <package name="default" namespace="/" extends="struts-default">
        </package>

       <include file="example.xml"/>
    </struts>

    (3) example.xml
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC
            "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
            "http://struts.apache.org/dtds/struts-2.0.dtd">
    <struts>
        <package name="example" namespace="/" extends="default">
            <!-- 액션매핑하기 -->
            <action name="test" class="test.action.MyTestAction">
                <result name="success">/view/result.jsp</result>
            </action>
           
        </package>
    </struts>

    + Recent posts