@Inject to pass params to a CDI @Named bean via URL

后端 未结 3 1175
忘了有多久
忘了有多久 2020-11-28 13:59

If I cannot use the @ManagedProperty annotation with @Named, because @ManagedProperty doesn\'t work in CDI(?), then how do you pass params in the URL to the facelets client?

3条回答
  •  暖寄归人
    2020-11-28 14:21

    First, to explain the alien part - Glassfish uses JBoss Weld as its CDI implementation, Oracle does not develop an implementation of its own.

    And concerning the meaning of the error message: FacesContext is simply not injectable via @Inject. There is an rather old feature request for that, and I think Seam or Solder provide a producer. But there's no need to integrate either of the libraries just for that. Access faces context like you would in normal managed bean, via FacesContext.getCurrentInstance().

提交回复
热议问题