我有以下2个ManagedBean:
@ManagedBean
@ViewScoped
public class MakeReservation {
...
@ManagedProperty(value="#{cartManagedBean}")
private CartManagedBean cartSession;
...
}
@ManagedBean
@SessionScoped
public class CartManagedBean {
...
}
当我尝试导航到MakeReservation.xhtml时,我看到了以下异常:
SEVERE: JSF will be unable to create managed bean makeReservation when it is requested. The following problems where found:
- The scope of the object referenced by expression #{cartManagedBean}, request, is shorter than the referring managed beans (makeReservation) scope of view
显然,cartManagedBean
的范围是SessionScope
。我不知道为什么Exception声称我的bean有RequestScope
。我曾多次尝试清理,构建和运行项目,但没有帮助。
如果有人能告诉我我做错了什么,我将非常感激。
致以最诚挚的问候,
James Tran
答案 0 :(得分:2)
请谨慎导入@SessionScoped
注释的正确包。