<i id='wPkrB'><tr id='wPkrB'><dt id='wPkrB'><q id='wPkrB'><span id='wPkrB'><b id='wPkrB'><form id='wPkrB'><ins id='wPkrB'></ins><ul id='wPkrB'></ul><sub id='wPkrB'></sub></form><legend id='wPkrB'></legend><bdo id='wPkrB'><pre id='wPkrB'><center id='wPkrB'></center></pre></bdo></b><th id='wPkrB'></th></span></q></dt></tr></i><div id='wPkrB'><tfoot id='wPkrB'></tfoot><dl id='wPkrB'><fieldset id='wPkrB'></fieldset></dl></div>
    • <bdo id='wPkrB'></bdo><ul id='wPkrB'></ul>

    1. <tfoot id='wPkrB'></tfoot>
      <legend id='wPkrB'><style id='wPkrB'><dir id='wPkrB'><q id='wPkrB'></q></dir></style></legend>

      <small id='wPkrB'></small><noframes id='wPkrB'>

        在 PRG 模式中如何在刷新成功页面上删除 ActionMessage

        In PRG pattern How to remove ActionMessage on refreshing success page(在 PRG 模式中如何在刷新成功页面上删除 ActionMessage)
      1. <legend id='e6XSP'><style id='e6XSP'><dir id='e6XSP'><q id='e6XSP'></q></dir></style></legend>
      2. <i id='e6XSP'><tr id='e6XSP'><dt id='e6XSP'><q id='e6XSP'><span id='e6XSP'><b id='e6XSP'><form id='e6XSP'><ins id='e6XSP'></ins><ul id='e6XSP'></ul><sub id='e6XSP'></sub></form><legend id='e6XSP'></legend><bdo id='e6XSP'><pre id='e6XSP'><center id='e6XSP'></center></pre></bdo></b><th id='e6XSP'></th></span></q></dt></tr></i><div id='e6XSP'><tfoot id='e6XSP'></tfoot><dl id='e6XSP'><fieldset id='e6XSP'></fieldset></dl></div>
          <tbody id='e6XSP'></tbody>

              <bdo id='e6XSP'></bdo><ul id='e6XSP'></ul>

              • <tfoot id='e6XSP'></tfoot>
                • <small id='e6XSP'></small><noframes id='e6XSP'>

                • 本文介绍了在 PRG 模式中如何在刷新成功页面上删除 ActionMessage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  为了避免表单重新提交,我使用了 POST-Redirect-GET 模式,它工作正常.现在在我的注册页面(成功页面)上显示 ActionMessage 评论插入成功!".当用户刷新页面时,我想删除此消息.

                  To avoid the form resubmission I used POST-Redirect-GET pattern and it is working fine. Now on my registration page(success page) it is showing the ActionMessage "Review Inserted successfully!". When user refreshes the page I want to remove this message.

                  我在 JSP 页面上的代码:

                  My code on JSP page:

                  <s:if test="hasActionMessages()">
                      <div class="success-mesg" id="success-mesg">
                          <s:iterator value="actionMessages">
                              <s:property value="top" />
                          </s:iterator>
                      </div>
                  </s:if>
                  

                  关于struts.xml:

                  On struts.xml:

                  <action name="insertReview" class = "com.tenkinfo.streamlinedmapnsav.ui.action.WriteReviewAction" method="insertReview" >
                      <result name="insertReviewDone" type="redirect" >insertReviewDone</result>
                      <result name="input" type="tiles">display.writeReview.page</result>
                  </action>
                  
                  <action name="insertReviewDone" class = "com.tenkinfo.streamlinedmapnsav.ui.action.WriteReviewAction" method="insertReviewDone" >
                      <result name="success" type="tiles" >display.writeReview.page</result>
                  </action>
                  

                  在动作类中:

                  public String insertReviewDone(){
                      addActionMessage("Write review is successful");
                      return "success";
                  }
                  

                  在执行 Aleksandr M 建议的答案后,我遇到了以下问题:

                  After implementing the answer suggested by Aleksandr M, I am having below problem:

                  <s:form name="insertReview" action="insertReview" id="insertReview"
                              theme="simple" enctype="multipart/form-data">
                          <div class="content-area">
                              <h1>
                              Review
                              <s:property value="businessName" />
                              </h1>
                              <s:if test="hasActionMessages()">
                              <div class="success-mesg" id="success-mesg">
                              <s:iterator value="actionMessages">
                          <s:property value="top" />
                      </s:iterator>
                     </div>
                  </s:if>
                  

                  刷新以上代码中的页面后,businessName 被删除,不显示.任何帮助将不胜感激.

                  After refreshing the page in above code businessName is removed and not displaying. Any help will be appreciated.

                  推荐答案

                  使用 Message Store Interceptor 将操作消息存储在您的 insertReview 中并在您的 insertReviewDone 操作中检索它.当您返回 insertReviewDone 结果时,在 insertReview 方法中添加操作消息.

                  Use Message Store Interceptor to store action message in your insertReview and retrieve it in your insertReviewDone action. Add action message in insertReview method when you are returning insertReviewDone result.

                  也可以使用 redirectAction 结果重定向到 action 而不是 redirect.

                  Also use redirectAction result to redirect to action instead of redirect.

                  <action name="insertReview" class = "com.tenkinfo.streamlinedmapnsav.ui.action.WriteReviewAction" method="insertReview">
                    <interceptor-ref name="store">
                      <param name="operationMode">STORE</param>
                    </interceptor-ref>
                    <interceptor-ref name="defaultStack" />
                  
                    <result name="insertReviewDone" type="redirectAction">insertReviewDone</result>
                    <result name="input" type="tiles">display.writeReview.page</result>
                  </action>
                  
                  <action name="insertReviewDone" class = "com.tenkinfo.streamlinedmapnsav.ui.action.WriteReviewAction" method="insertReviewDone" >
                    <interceptor-ref name="store">
                      <param name="operationMode">RETRIEVE</param>
                    </interceptor-ref>
                    <interceptor-ref name="defaultStack" />
                  
                    <result name="success" type="tiles">display.writeReview.page</result>
                  </action>
                  

                  这篇关于在 PRG 模式中如何在刷新成功页面上删除 ActionMessage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Compiling C++ for the JVM(为 JVM 编译 C++)
                  Compile to java bytecode (without using Java)(编译成java字节码(不使用Java))
                  How to drive C#, C++ or Java compiler to compute 1+2+3+...+1000 at compile time?(如何在编译时驱动 C#、C++ 或 Java 编译器计算 1+2+3+...+1000?)
                  Java ClassLoader: load same class twice(Java ClassLoader:两次加载相同的类)
                  How to debug .class files in ECLIPSE?(如何在 ECLIPSE 中调试 .class 文件?)
                  Java quot;The blank final field may not have been initializedquot; Anonymous Interface vs Lambda Expression(Java“可能尚未初始化空白的最终字段匿名接口与 Lambda 表达式)

                          <bdo id='O7yBw'></bdo><ul id='O7yBw'></ul>
                          <i id='O7yBw'><tr id='O7yBw'><dt id='O7yBw'><q id='O7yBw'><span id='O7yBw'><b id='O7yBw'><form id='O7yBw'><ins id='O7yBw'></ins><ul id='O7yBw'></ul><sub id='O7yBw'></sub></form><legend id='O7yBw'></legend><bdo id='O7yBw'><pre id='O7yBw'><center id='O7yBw'></center></pre></bdo></b><th id='O7yBw'></th></span></q></dt></tr></i><div id='O7yBw'><tfoot id='O7yBw'></tfoot><dl id='O7yBw'><fieldset id='O7yBw'></fieldset></dl></div>
                          <legend id='O7yBw'><style id='O7yBw'><dir id='O7yBw'><q id='O7yBw'></q></dir></style></legend>
                            <tfoot id='O7yBw'></tfoot>
                              <tbody id='O7yBw'></tbody>
                          1. <small id='O7yBw'></small><noframes id='O7yBw'>