JSF/Mojarra “flash scope” problems

 ̄綄美尐妖づ 提交于 2019-11-29 15:18:36

I saw the same. At the time I tried it Seam3 was very buggy and it's very hard to get it deployed to different servers. I switched to MyFaces CODI which worked without any problems from the very beginning. In your case you should have a look at @ViewAccessScoped. You can get rid of all those annoying workarounds.

Declare the parameters which you'd like to set or pass through to the next view in a

<f:metadata>
    <f:viewParam name="foo" value="#{bean.foo}" />
</f:metadata>

This does basically bean.setFoo(request.getParameter("foo")) during update model values phase of the GET request.

If you add includeViewParams=true parameter to the navigation outcome, then the ones which are declared as <f:viewParam> of the current view will be passed through to the next view.

public String doSomething() {
    // ...
    return "next?faces-redirect=true&amp;includeViewParams=true";
}

(note: the &amp; is important! the & won't work as it's not XML-valid)

The next view should have the same <f:viewParam> to get them to set in the bean. And so on.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!