The Hyperlink component
is used either as a standard hyperlink to a URL or a link to a Visual Web JSF page in your application. This component is equivalent to an HTML
<a>
element.
If you set the action
property by right-clicking the component and choosing Edit action Event Handler, the page is submitted. If instead you set the url
property, the link is a normal hyperlink that sends the browser to a new location.
If you want the link to be represented as an image instead of as text, use the Image Hyperlink component.
If you drop a component on the Hyperlink, you embed the component in the hyperlink, and you must work with the embedded component's properties rather than the properties of the Hyperlink. Select the embedded component in the to set the embedded component's properties.
After adding a hyperlink to a page, you can do a number of things with it:
id
attribute. In the page bean, this property's value is the name of the Hyperlink
object.url
property overrides any action event handler you might define, as described below. If this property is set, when the user clicks the hyperlink they are taken directly to the URL and the page is not submitted. If this property is not set, clicking the hyperlink submits the page. Typically, if you do not set this property, you use the action even handler to define what happens when the user clicks the hyperlink.action
property to the name of this method. See the url
property above for information about how these two properties interact.
The action event handler determines which page or resource to open based on specified conditions. The action method typically processes mouse clicks and returns a string indicating the name of a page navigation case (the page in your application to display next). The default name for the method is hyperlink-id
_action
, where hyperlink-id is the value of the hyperllink's id
property.
text
property to a data provider or an object that dynamically sets the displayed text of the hyperlink. For more information, see Bind to Data Dialog Box.text
property to other objects or properties that supply data for the values of this component's properties.