Tag: post redirect get

includeViewParams = true在模板化页面中不起作用

考虑这个模板: 这个使用它的页面(/pages/test.xhtml): 页面的bean: @Named @RequestScoped public class PageBean implements Serializable { public String getFoo() { return foo; } public void setFoo(String foo) { this.foo = foo; } private String foo; } 而这个豆子: @Named @ApplicationScoped public class Util implements Serializable { public String currentPageAction() { return FacesContext.getCurrentInstance().getViewRoot().getViewId() + “?faces-redirect=true&includeViewParams=true”; } } 当我在浏览器中加载http://localhost:8080/faces/pages/test.xhtml?foo=bar并单击 ,URL将更改为http://localhost:8080/faces/pages/test.xhtml 。 也就是说,视图参数不包含在重定向URL中。 但是,当我重构页面使其不使用模板时,它的行为与预期的一样。 […]

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

为了避免重新提交表单,我使用了POST-Redirect-GET模式,它运行正常。 现在在我的注册页面(成功页面)上显示ActionMessage“Review Inserted successfully!”。 当用户刷新页面时,我想删除此消息。 我在JSP页面上的代码: 在struts.xml上: insertReviewDone display.writeReview.page display.writeReview.page 在Action类中: public String insertReviewDone(){ addActionMessage(“Write review is successful”); return “success”; } 编辑: 在实现Aleksandr M建议的答案后,我遇到了以下问题: Review 在上面的代码刷新页面后,businessName被删除而不显示。 任何帮助将不胜感激。