I have the following 2 ManagedBean:
@ManagedBean
@ViewScoped
public class MakeReservation {
...
@ManagedProperty(value="#{cartManagedBean}")
private CartManagedBean cartSession;
...
}
@ManagedBean
@SessionScoped
public class CartManagedBean {
...
}
When I try to navigate to MakeReservation.xhtml, I saw the following exception:
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
Obviously, the scope of cartManagedBean is SessionScope. I have no idea why the Exception claimed that my bean has RequestScope. I have tried to Clean, Build and Run the Project several times but it didn’t help.
I’d be very grateful if someone could show me where I have done wrong.
Best regards,
James Tran
Be carreful to import the right package for your
@SessionScopedannotation.