谁能帮我解释一下下面这个struts配置文件么?完全看不懂啊。

[code="java"]
<!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

<!-- Constants -->










<!-- Configuration for the default package. -->
<package name="default" extends="struts-default">
    <interceptors>
        <!-- Interceptor to handle allowing only admins to certain actions -->
        <interceptor name="adminOnly" class="adminInterceptor" />
            <!--Copied from struts-default.xml and changed validation exclude
            methods
        -->
        <interceptor-stack name="defaultStack">
            <interceptor-ref name="exception" />
            <interceptor-ref name="alias" />
            <interceptor-ref name="servletConfig" />
            <interceptor-ref name="prepare" />
            <interceptor-ref name="i18n" />
            <interceptor-ref name="chain" />
            <interceptor-ref name="debugging" />
            <interceptor-ref name="profiling" />
            <interceptor-ref name="scopedModelDriven" />
            <interceptor-ref name="modelDriven" />
            <interceptor-ref name="fileUpload" />
            <interceptor-ref name="checkbox" />
            <interceptor-ref name="staticParams" />
            <interceptor-ref name="params">
                <param name="excludeParams">dojo\..*</param>
            </interceptor-ref>
            <interceptor-ref name="conversionError" />
            <interceptor-ref name="validation">
                <param name="excludeMethods">cancel,execute,delete,edit,list</param>
            </interceptor-ref>
            <interceptor-ref name="workflow">
                <param name="excludeMethods">input,back,cancel,browse</param>
            </interceptor-ref>
        </interceptor-stack>
        <interceptor-stack name="fileUploadStack">
            <interceptor-ref name="fileUpload" />
            <interceptor-ref name="defaultStack" />
        </interceptor-stack>
        <interceptor-stack name="adminCheck">
            <interceptor-ref name="defaultStack" />
            <interceptor-ref name="adminOnly" />
        </interceptor-stack>
    </interceptors>

    <global-results>
        <result name="mainMenu" type="redirectAction">index</result>
        <result name="dataAccessFailure">/WEB-INF/pages/dataAccessFailure.jsp</result>
    </global-results>

    <global-exception-mappings>
        <exception-mapping exception="org.springframework.dao.DataAccessException"
            result="dataAccessFailure" />
    </global-exception-mappings>

    <action name="mainMenu">
        <result name="success">/WEB-INF/pages/index.jsp</result>
    </action>

    <action name="signup" class="signupAction">
        <result name="cancel" type="redirect">/</result>
        <result name="input">/WEB-INF/pages/signup.jsp</result>
        <result name="success" type="chain">saveSignup</result>
    </action>

    <action name="saveSignup" class="signupAction" method="save">
        <result name="input">/WEB-INF/pages/signup.jsp</result>
        <result name="success" type="redirectAction">/mainMenu</result>
    </action>

    <action name="editUser" class="userAction" method="edit">
        <interceptor-ref name="adminCheck" />
        <result name="success">/WEB-INF/pages/userForm.jsp</result>
        <result name="input">/WEB-INF/pages/admin/userList.jsp</result>
    </action>

    <action name="editProfile" class="userAction" method="edit">
        <result name="success">/WEB-INF/pages/userForm.jsp</result>
        <result name="error">/WEB-INF/pages/mainMenu.jsp</result>
    </action>

    <action name="saveUser" class="userAction" method="save">
        <result name="cancel" type="redirectAction">admin/users</result>
        <result name="input">/WEB-INF/pages/userForm.jsp</result>
        <result name="success" type="redirectAction">admin/users</result>
    </action>

    <action name="queryTargetUsers" class="com.asb.oas.webapp.action.UserAction"
        method="queryUser">
        <result name="success" type="stream">
            <param name="contentCharSet">GBK</param>
        </result>
    </action>

    <!--
        action name="uploadFile"
        class="com.asb.oas.webapp.action.FileUploadAction"> <interceptor-ref
        name="fileUploadStack" /> <result
        name="input">/WEB-INF/pages/uploadForm.jsp</result> <result
        name="success">/WEB-INF/pages/uploadDisplay.jsp</result> <result
        name="cancel" type="redirectAction">mainMenu</result> </action
    -->

    <action name="passwordHint" class="passwordHintAction">
        <result name="input">/</result>
        <result name="success">/</result>
    </action>

    <action name="index" class="signupAction" method="index">
        <result>/WEB-INF/pages/index.jsp</result>
    </action>

[/code]

这是从别人的项目里贴过来的,我自己的项目的struts完全没这么复杂啊.谁帮我解释一下,或者指条明路。

3个回答

这也算复杂。。。。配置文件都没看懂,你不去看看官方对每个标签的使用说明?

刚学struts2的时候看不懂配置文件很正常。。不过确实是一些常用的配置。。
推荐个博客,研磨struts2:http://rubbing-struts2.iteye.com/
:)

u010437412
Lu夏夜 没事de ~
大约 6 年之前 回复
zengjd
zengjd 本来想选你这个好评的,结果点错了。还改不了了,真可恶。
大约 6 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐