File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Listening for a link selection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Listening for a link selection" Watch "Listening for a link selection" New topic

Listening for a link selection

Michael Zellmann

Joined: Dec 17, 2004
Posts: 18
I am new to JSF, and working on an application where the user is shown a DataTable of possible links. Each is represented in an <hutputLink component. When that link is chosen, the user sees the requested page in a new window - all behavior as intended. I want to implement a Listener that will capture what link the user chose. When I try to add a <f:actionListener type=... component, I get an error that an action listener can only be nested within a component that is a Faces ActionSource. (that make sense) However, the only components that do that are HtmlCommandButton, HtmlCommandLink and UICommand. I don't see how to accomplish what I am looking for. What can I do?
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15302

Why can't you use a commandLink?

GenRocket - Experts at Building Test Data
Michael Zellmann

Joined: Dec 17, 2004
Posts: 18
Thanks for the reply. With your suggestion, I got it to work! Had to do some fiddling to get the href link and the title to work out. Also had to wrap it in a <h:form tag> even though I don't need any servlet handling.
I agree. Here's the link:
subject: Listening for a link selection
It's not a secret anymore!