Enterprise Java

How to Pass Parameters to ActionListener in ADF

In some cases, it is required to pass a value to ActionListener of ADF Button.

The method that can be invoked by actionListeners has only one parameter of type ActionEvent. 

So I will explain how to pass parameter to that bean method however it contains only one paramater ActionEvent in method signature.

I added button to my page as below

The default signature of ActionLister is 

The workaround I used is adding an attribute tag from the JSF.Core inside the ADF Button So the code in the jsp page looks like this

Note “MyAttrName” is the name of paramater and “MyAttrValue” is the value of paramater.

You can bind  “MyAttrValue” to get any value from page definition.

Now I will write the followign code to get paramatervalue from bean

The variable “attrValue” holds the value of paramaters which is “MyAttrValue” in this example.

Thanks

Mahmoud Elsayed

Published on Java Code Geeks with permission by Mahmoud ElSayed, partner at our JCG program. See the original article here: How to Pass Parameters to ActionListener in ADF

Opinions expressed by Java Code Geeks contributors are their own.

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Back to top button