1

As stated in many posts here (e.g. here), the problem of ViewScoped beans being recreated over and over again should be gone with JSF 2.2.

So I have udated to MyFaces 2.2 and changed the imports in my view scoped beans to:

package javax.faces.view.ViewScoped;

@Named
@ViewScoped
public class MyView {
    ....
}

But still the ViewScoped Beans behave even worse than RequestSqoped Beans - the @PostConstruct method is run through several times on view creation and on every interaction with the page.

The JSR299 dependencies are:

  • weld 1.1.Final
  • wel-core 1.1.14.Final
  • codi 1.0.5

The jsp/servlet version read like:

  • javax.servlet-api 3.0.1
  • jsp-api 2.2

Has anyone made ViewScope work as designed under MyFaces 2.2 and CODI?

Community
  • 1
  • 1
  • IIRC there's still a chicken-and-egg issue if you reference the `@ViewScoped` bean in a view build time tag. But I've no idea if this applies to JSP, too. – mabi Feb 24 '14 at 11:10
  • ViewScoped is JSF specific. Post relevant facelet. – Karl Kildén Feb 24 '14 at 18:33
  • Also make sure you're running a CDI 1.1 implementation. Weld 1.1 is a CDI 1.0 impl, use Weld 2.x, preferably latest. – John Ament Feb 25 '14 at 03:10

0 Answers0