我有以下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。我不知道为什么该异常声称我的bean具有RequestScope。我曾多次尝试清理,构建和运行该项目,但没有帮助。

如果有人可以告诉我我做错了什么,我将不胜感激。

最好的祝福,

詹姆士·特兰

最佳答案

请注意为@SessionScoped批注导入正确的包。

10-05 22:43