Adding hyperlinks to a Faces JSP file
You can use the Link component and the Command - Hyperlink component to add linking to your Web project.
Generally, you use the Link component to link to Web pages that are outside the Web project and the Command - Hyperlink component to link to internal pages. The Command - Hyperlink component is also useful for enabling additional actions when a link is activated. The hyperlink can perform updates and then identify the next page within a Web project to navigate to. For example, you can use the Command - Hyperlink component for actions that apply to a single row in a relational record list. To add a Command - Hyperlink component to a Faces JSP page
- Drag a Command - Hyperlink component from the palette to the page or to an Output or Image component already on the page.
Note: If you drop the Command - Hyperlink component onto a blank area of the Faces JSP page, an Output component is automatically added within the Command - Hyperlink component. The Output text contains the label for the link.
- To change the label, select the Output Text component. In the Properties view for the Output Text component, enter a new label in the Value field. This is the link text that displays at run time.
- Use the Quick Edit view to create an action for the link as the Command event. (See Adding scripted events to Web pages.)
- Then add navigation by clicking Add Rule on the Properties view of the Command - Hyperlink component. The "Add Navigation Rule" dialog opens. With Navigation Rules, you can direct the user to certain pages depending on what has just occurred (for example, an error). You can select a page to navigate to, an alias for the page (an alias indicates that some action has occurred, such as an error, that should send the user to the specified page), and an ActionRef (a Java action method to use when the hyperlink is clicked).
- Set additional Command - Hyperlink properties. For example, you can add any parameters on the Parameters tab of the Command - Hyperlink Properties view. These parameters are then passed to the action.
Related concepts
Faces components
Related tasks
Creating Faces applications - overview
Adding scripted events to Web pages
Using navigation rules with Faces JSP pages
Associating actions with a data table
Passing parameters between JSP files
Related reference
Faces components reference
Attributes for Faces components