I have 2 managed beans in session scope. In one managed bean, i get a list of drop down values and display it on the screen. In another UI, i add values to the drop down list. When i am in the same session, when i add values to the drop down, the values do not reflect in the drop down on UI. The old session retains even though the values are inserted in the database. Any inputs on how to fetch the latest values always in the drop down list will be appreciated.
Make it a request scoped bean. Or manually access the bean in session scope and update the data. Or introduce the observer pattern so that it can get notified when new values are added then let it reload the data.
You can access session scoped beans by ExternalContext#getSessionMap() (which is actually backed by HttpSession attributes). The managed bean name is the map key.
There is a method to fetch the drop down list values in the managed bean. So should I fetch the complete bean using the getSessionmap().get() ? how can i get only the drop down list and upadet the values as you mentioned.
How is obtaining a reference to a managed bean an issue? Your concern doesn't make much sense. If you don't want to access it by the sessionmap, you can also declare it as a managed property of the other bean.