Best Practice :-
Managed bean after running will loaded in web container into your application or web server as an object and if any request came to it, application server will get an instance from it and load that instance in memory and give you chance to use all operations inside it.
During our implementation if you need any variable from another managed bean to use it in current bean you cannot create an object from it as it not a best practice to access the managed bean, as best practice say "Only One Object be Loaded and many instances can be taken from it", so ADF and JSF provide a way to access say Session bean with out create an Object from it.
As you only will create a reference to loaded object inside application server and then you can get any data you need, so that we will have one object and many references refer on it.
Source Code:-
loginOperations ob = (loginOperations)ADFContext.getCurrent().getScope("sessionScope").get("loginOperations");
String errorPath = ob.getFromPath();
No comments:
Post a Comment