@ManagedBean(name=“foo”) not available by its name in EL #{foo}

前端 未结 1 576
温柔的废话
温柔的废话 2021-01-24 16:26

I\'m trying to use an application scoped bean in JSF2, but for some reason it is always null in my request scoped bean. Here\'s the code I\'m using:

The ap

相关标签:
1条回答
  • 2021-01-24 17:27

    Provided that you imported those annotations from the right package javax.faces.bean.*, then this problem will happen if you re-registered the very same managed bean class in faces-config.xml on a different managed bean name. Get rid of that faces-config.xml entry. That's the JSF 1.x style of registering managed beans. You don't need it in JSF 2.x. When you do so anyway, then it will override any annotation based registration on the managed bean class, causing them to be ineffective.

    Make sure you don't read JSF 1.x targeted resources while learning and working with JSF 2.x. Many things are done differently in JSF 2.x.

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