JSF/Mojarra “flash scope” problems

前端 未结 2 598
孤独总比滥情好
孤独总比滥情好 2020-12-21 07:26

I\'ve got an app running on Mojarra 2.1.1 / Glassfish 3.1 which has now grown to 150,000+ lines of code. The app uses ajax extensively with ViewScoped managed beans and the

相关标签:
2条回答
  • 2020-12-21 08:00

    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.

    0 讨论(0)
  • 2020-12-21 08:06

    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.

    0 讨论(0)
提交回复
热议问题