jQuery in Action, 2nd edition*
The moose likes JSF and the fly likes Trying to figure out java code to bind to outputLinks generated from a4j:repeat tags Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Trying to figure out java code to bind to outputLinks generated from a4j:repeat tags" Watch "Trying to figure out java code to bind to outputLinks generated from a4j:repeat tags" New topic
Author

Trying to figure out java code to bind to outputLinks generated from a4j:repeat tags

Matt Kohanek
Village Idiot
Ranch Hand

Joined: Apr 04, 2009
Posts: 483

This is the jsf code:


This essentially is just a List of Devices, each one also an outputLink sending the user to another jsf page that has two fields bound to java variables - deviceId and deviceName.

So I need to have a way to carry over the Device data depending on which link the user clicks on. I have an idea how to do so but Im not there yet. Here is what i have been working on:



Now this is not working yet of course, particularly line 3 is underlined with this error:
Cannot cast from Component to Device

So Im not sure what needs to be changed here. Is (MouseEvent event) the correct thing to go in between the parentheses or does that need to be something else like (FacesContext event)?
If MouseEvent event will work, I'm sure all I need is some line to go before that third line that first casts event to something else that is then castable to Device.

When I did this in reference to my rich:tree I used:



This works for clicking on a tree node but I need something for clicking on a command Link


True wisdom is in knowing you know nothing - Socrates
Rami Hailat
Greenhorn

Joined: Nov 26, 2008
Posts: 20
hi Matt,

you code will not work cause you bind an instance of outputLink to a method on the managed bean, and not an instance of
outputLink. so create a variable of type outputLink name it myOtputLink
and replcae line 3 with this
 
jQuery in Action, 2nd edition
 
subject: Trying to figure out java code to bind to outputLinks generated from a4j:repeat tags
 
Similar Threads
Need my rich:tree to be re loaded when I add a new entity to it
Help extracting text out of a response
Trying to bind inputText fields from an a4j:repeat tag to java code
need nodes on rich:tree to not be auto selected, only selected when clicked on.
having clicking on a treeNode from rich:tree change ui:define content (need help)