Struts2令牌 - 会话拦截器问题

问题描述 投票:0回答:1

我在我的业务Web应用程序中使用Struts 2,并且为了防止在刷新页面时双重输入,我在我的struts.xml文件中添加了拦截器

<interceptor-ref name="tokenSession"/>

当我将插入此语句时,它将始终重定向到invalid.token并转到tiles - requisition.tiles。我做错了什么?

如果我将删除上面的拦截器然后它将正常工作,那么问题是什么?

我在struts2.xml中的代码

<action name="*Requisition" class="com.sttl.rpsc.action.RequisitionAction" method="{1}Requisition">
        <interceptor-ref name="basicStack" />
        <interceptor-ref name="validation">
            <param name="excludeMethods">setupRequisition,setupPostRequisition,setupQualificationRequisition,setUpForUpdateQualificationRequisition,
            setupAgeRequisition,setupReservationRequisition,deletePostRequisition,showSaveCancelRequisition,setUpForUpdateAgeRequisition,setUpForUpdateReservationRequisition,
            deleteQualificationRequisition,deleteAgeRequisition,deleteReservationRequisition,setScrutinizePostRequisition</param>
        </interceptor-ref>
        <interceptor-ref name="tokenSession"/>

        <result name="invalid.token" type="tiles">/requisition.tiles</result> 
        <result name="input" type="tiles">/requisition.tiles</result>
        <result name="success" type="tiles">/requisition.tiles</result>
        <result name="error" type="tiles">/requisition.tiles</result>
        <result name="cancel" type="redirect">rpscadminsecure.action</result>
        <result name="getRequisitionList" type="chain">setupRequisition</result>
        <result name="reqsuccess" type="chain">setupPostRequisition</result>
        <result name="postsuccess" type="tiles">/requisitionpost.tiles</result>
        <result name="qualisuccess" type="tiles">/requisitionqualification.tiles</result>
        <result name="agesuccess" type="tiles">/requisitionage.tiles</result>
        <result name="ressuccess" type="tiles">/requisitionreservation.tiles</result>
        <result name="saveOrCancelsuccess" type="tiles">/saveOrCancelrequisition.tiles</result>
        <result name="cancelSuccess" type="redirect">setupRequisition</result>

        <result name="successSetupScrutinize" type="tiles">/requisitionpost.tiles</result>

    </action>
struts2
1个回答
1
投票

您必须更改拦截器中声明的顺序。像这样的东西:

<action name="someAction" class="com.examples.SomeAction">
<interceptor-ref name="token-session/>
<interceptor-ref name="basicStack"/>
<result name="success">good_result.ftl</result>
</action>  

basicStack是订单中的最后一个。

© www.soinside.com 2019 - 2024. All rights reserved.