私は2つManagedBeans
(@SessionScoped
と@ViewScoped
)を持っています:
@ManagedBean(name="sessionController")
@SessionScoped
public class SessionController implements Serializable{
private PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);
public void addPropertyChangeListener(PropertyChangeListener listener) {
propertyChangeSupport.addPropertyChangeListener(listener);
}
...
}
@ManagedBean(name="viewController")
@ViewScoped
public class ViewController implements Serializable, PropertyChangeListener{
@ManagedProperty(value="#{sessionController}")
private SessionController sessionController ;
...
@PostConstruct
public void init() {
sessionController.addPropertyChangeListener(this);
}
@Override
public void propertyChange(PropertyChangeEvent evt) {
...
}
}
の変更について知るためPropertyChangeListener
に使用できますか?問題がありますか?ViewController
SessionController