See Also | Tutorials
You can drag the Hyperlink
component
from the Basic category of the Palette to the Visual Designer to create a standard hyperlink to a URL.
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 use this component to navigate between pages of a portlet, do not use the
url property to link to a page. Instead, use the Navigation editor to set up your links to pages.
- Note: You can drop an Image component or a Static Text component or both on the Hyperlink if you want to customize the appearance of the link.
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 Outline window to set the embedded component's properties.
After adding a hyperlink to a page, you can do a number of things with it:
- Select the component and edit its properties in the component's Properties window. Some typical properties to edit are:
- id. The name of the component. In the JSP file, this name is the value of the component's id attribute. In the page bean, this property's value is the name of the
Hyperlink object.
- text. The displayed text for the link. You can also click the component and edit this value.
- url. The URL to the target document or resource that the hyperlink is to open. The page is not submitted if this value is set and the user clicks the hyperlink.
- Right-click the component in the Outline window and choose one of the following pop-up menu items:
- Edit action Event Handler. Code the action event handler, the method that is called when the user clicks the hyperlink. This method 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.
- Bind to Data. Opens a dialog box that enables you to bind the component's
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.
- Property Bindings. Opens a dialog box that enables you to bind properties of the component in addition to the
text property to other objects or properties that supply data for the values of this component's properties.
- See Also
- Binding Component Properties
- Working
With Components
- Component
Tasks: Quick Reference
- Component
Web Tutorials
- Data
Source Web Tutorials
- About the Palette
- Tutorials
- Delving Into Components Tutorial