Get the command link clicked in adf?

I have 50 different command links on a jsff page. I want to get the commandlink clicked in the backing bean? How to do this? I just have to use one single method in the backing bean

Answers


Write a listener and call the same listener on all of your command links. Inside the Listener Metod call event.getAttributes() which will return the Map of attributes. From the Map you can find the id property of the link submitted by the user.


Simply attach an actionListener:

<af:commandLink text="Command link 1" actionListener="#{bean.link1}"/>
<af:commandLink text="Command link 2" actionListener="#{bean.link2}"/>
<af:commandLink text="Command link 3" actionListener="#{bean.link3}"/>
...

The methods link1, link2, link3 etc. are called when you press the corresponding command link, so you implicitly know which link has been pressed.


Write a listener in backing bean , listener method will have "ActionEvent" as an argument. ActionEvent has apis getSource(),getComponent(), which can be leveraged to get the commandlink clicked.


if you want to call 50 command link from backing bean, you can queue them one after- see Invoking Button Action Programmatically,Queuing ActionEvent


Need Your Help

Relationship between multiple JOINs

mysql join

If I have a sequence of multiple JOINs in a MySQL query, such as

Slide down a div on body load

javascript jquery css slidedown pageload

How can I have a div hide as the page is loading and then slide down once the page loads? I don't want to use CSS display:none;

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.