You can drag the Standard JavaServer Faces Link Action component
from the Palette's Standard category to the Visual Designer to create a hyperlink
that the user can click to open another page in your web application.
If you want a simple hyperlink, use the Hyperlink
component instead.
When the web page is generated, the Link Action becomes an HTML <a>
element with the onclick attribute defined to submit the page and open
the linked page.
This component is a JavaServer Faces reference implementation that cannot use themes. The Hyperlink component and the Image Hyperlink component in the Basic category do support themes and provide other features that improve ease of use.
After dragging the component to the Visual Designer, you can do a number of things
with it:
Change the displayed text of the link by selecting the inner, linkActionText part
of the component and then just typing in the text.
Select either the text element (inner part) or the command
hyperlink element (outer part). This component is composed
of a linkAction component and an embedded linkActionText component,
which is an Output Text component, as you can see in the Navigator window. Depending on where you click this component in
the Visual Designer, you get different Properties windows. You
use the linkAction to set the link part of the component,
and the linkActionText part to set the text of the link.
Select the component and drag it to another location on
the page.
Select the linkAction part
of the component and edit its properties in the Link Action Properties window. A typical property you might set is:
id. The name of the Link Action. In the JSP
file, this name is the value of the id attribute.
In the page bean, this property's value is the name of
the HTMLCommandLink object.
Select the linkActionText
part of the component and edit its properties in the Output
Text Properties window. The most useful thing you can do in the Properties window is to set the visible label (or link text) for the component
in the value property. You can also bind the Output Text component
to a table and set the label dynamically.
Right-click the Link Action component and choose one of
several actions:
Edit Event Handler. Code one of the following
event handlers:
action. Opens the Java Editor with the cursor
positioned in the component's action method so you
can insert code that executes when the user clicks
the component. The method must return a String
that is the name of a navigation connector connecting this
page to another page in your application. For more
information, see Setting Up Dynamic Page Navigation.
If you just want to use this component to connect
this page to another dynamic page, you can right-click
the page background and choose Page Navigation to
open the Page Flow editor and connect the component
to another page. For more information, see Setting Up Static Page Navigation.
actionListener. Opens the Java Editor with
the cursor positioned in the component's actionListener
method so you can insert code that calls a method
when the user clicks the component. The method must
return a String that is the name of a navigation
connector connecting this dynamic page to another dynamic
page in your application.
Bind to Data. Dynamically set the text that displays for the link. You can bind the component's value property to an object or a data provider, as described in the topic Bind to Data Dialog Box.
Property Bindings. Opens a dialog box that enables you to bind properties of the component in addition to the vlaue property to other objects or bean properties that update this component's properties automatically.