ViewScope constructor called twice, not sure why

前端 未结 1 2041
没有蜡笔的小新
没有蜡笔的小新 2021-02-06 16:29

I\'ve seen the other questions regarding calling a bean constructor and ViewScope, and I\'m still having difficulty. The problem I\'m seeing involves two specific pages in my a

1条回答
  •  情歌与酒
    2021-02-06 16:38

    You need to remove the @RequestScoped and other related annotations from the UIBaseBean (and make it abstract).

    Once that is done, you also need to fix the @ManagedProperty on #{param} to be either defined by or to be obtained by ExternalContext#getRequestParameterMap() instead. It's namely not possible to inject something which has a shorter scope into something which has a larger scope (because it's not clear which one should be injected since there can be more of them during the scope of the acceptor). JSF would throw an exception on that during bean's construction.

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