If you application need to perform some business operation with multiple entity and view object then best place to put your method Is application module implementation class. I will explain you here just how to use application module method from managed bean.
Create simple ADF Fusion project and double click application module and generate Impl class by going to java tab.
Then open impl.java class and write you own java method.
How to call this java method from button , hyperlink or even manage bean.
We need to expose this method before calling it.
I opened the client interface and shuttled that method to application module. Now this method will be visible in data control along with viewobjects that are exposed.
So it is as simple as this. This way you can write multiple method for various business operation like PaySalary , IncreaseSalary and more.
You can also see that there are other client.java file created to managed this.
Command Button calling this method
I created JSF page with one managed bean in back bean scope , you can also create backing bean.
If you refresh the datacontrol window then you will see that method as below.
Now just drag and drop this method on JSF page as button or hyperlink and run the page.
If you click the button you will see that sop statement is called and it is printing the message.
Calling method from managed bean
Drag and Drop command button on page and double click it and create a method in managed bean.
write following code and run the application and you will see the same printed message as before.
The advantage of calling from managed bean is ,if you have any GUI logic here that will decide which method to call then it is right place.
Eg:- do I need to call salary decrease or salary increase.
This is very valuable information to me. Thanks for publishing.
ReplyDeleteNagaraju
thanks.. helpful..
ReplyDeletethanks...helpful... publish more on data bindings too
ReplyDeleteGetting NPE after invoking method in AM :(
ReplyDeletethanks ..very useful info for beginners
ReplyDelete