I'm using JSF 2.1 and Primefaces:
I have a view scoped managed bean with a managed property and a method that set something on other view scoped managed bean and forward to other page referencing that managed bean:
@ManagedBean
@ViewScoped
public class HelloMB {
@ManagedProperty("otherMB")
private OtherMB other;
public String changeOtherMB() {
otherMB.setAnyObject(new Object());
return "otherPage.xhtml";
}
}
@ManagedBean
@ViewScoped
public class OtherMB {
private Object o;
public void setAnyObject(Object o) {
this.o = o;
}
}
So, when otherPage is rendered o
is null.
You have idea how could I solve this? How can I retain an Object in a @ViewScoped
managed bean and keep it live on other page without using @SessionScoped
?