IntelliJ Java IDE
The moose likes JSF and the fly likes How to identify which commandLink was clicked? [SOLVED] Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "How to identify which commandLink was clicked? [SOLVED]" Watch "How to identify which commandLink was clicked? [SOLVED]" New topic
Author

How to identify which commandLink was clicked? [SOLVED]

Leigh Taylor
Greenhorn

Joined: Feb 19, 2008
Posts: 20
Hi,

I have recently jumped into the land of jsf and am trying to absorb everything there is. I have run into an issue where i have a number of commandlinks being produced within a dataTable. Each command link calls the same javaScript method. How can i parse information so the javascript method knows which link was clicked?



I have no idea who to tackle this issue. I have a hidden variable so i can access all the address matches. Though how do i know which link is clicked?

Thanks
[ February 25, 2008: Message edited by: Leigh Taylor ]
Bob Good
Ranch Hand

Joined: Jan 09, 2008
Posts: 86
Maybe you could set a hidden field or a variable to a unique value from each link onmousedown.

Or have each link call different javascript, that each in turn call a common javascript function.

I do not know why you are using javascript for an action method instead of server side java code, but I have not used a4j.
Leigh Taylor
Greenhorn

Joined: Feb 19, 2008
Posts: 20
Thanks for the reply Bob. As i was generating the links dynamically it wasn't possible to include individual javaScript methods.

I did however work out a solution. The problem being my limited knowledge of binding.

Simply added a binding attribute to the datatable and bound it to the backing bean.






So the link calls the java method and the method then grabs the row data which i re-injected into my JSP page on reRender.

Leigh
 
 
subject: How to identify which commandLink was clicked? [SOLVED]
 
Threads others viewed
jsf page that does not update values according to the model
validation of inputText in rich:dataTable
Finding which cell was clicked in a DataTable?
display multiple rich:dataTables
Rich:Datatable rerendering problem
MyEclipse, The Clear Choice

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture