struts2 右鍵重新整理重複添加記錄 儲存完之後右鍵重新整理添加相同記錄

來源:互聯網
上載者:User
 步驟1:該類所在的struts 的設定檔中添加攔截器如:注意struts設定檔定義攔截器都是通用的。一個設定檔只需添加一次就可以
定義通用攔截器
<interceptor name="actionMessageStore"   class="com.nwpunec.system.MessageStoreInterceptor"></interceptor>
定義攔截堆棧
<interceptor-stack name="myDefault">
 <interceptor-ref name="actionMessageStore" >
             <param name="operationMode">AUTOMATIC</param>
         </interceptor-ref>
 <interceptor-ref name="defaultStack"></interceptor-ref>
</interceptor-stack>
在action的配置中添加重新導向方法如:
<result name="list" type="redirect">tbAmStufeeInfo!getAllStuFeeUsePage.action?operationMode=AUTOMATIC&amp;nowPage=1</result>
步驟二:修改action裡面的儲存方法如:
在建立儲存的時候將return 返回的方法修改為return=“list”
將訊息提示修改為addActionMessage(“建立成功”)
比如:繳費儲存
Message.info(request, "建立繳費記錄添加成功!");
return getAllStuFeeUsePage();
修改為:addActionMessage("建立繳費記錄添加成功");
 return "list";
步驟三:修改返回的查詢頁面,在頁面form標籤下添加<s:actionmessage/>標籤

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.