You can drag an Anchor component from the Palette's Basic category to the Visual Designer to create a named anchor in your page. The HTML equivalent of this component is
<a name=targetname></a>
. The name of the anchor component, set in its id
property, is the target name.
For example, you drop an anchor at the bottom of a page and see that its name is anchor1. You then add a hyperlink to the top of the page and set the hyperlink's url
property to #anchor1
to link it to the anchor.
Drop the anchor on the page at the location to which you want the page to scroll when the user clicks a link to the anchor. You can also drag the anchor to another location on the page.
If you want to link to an anchor in another page, use a hyperlink component and set its url
property by using the property editor to navigate to the anchor. For example, if the page is named Page2.jsp
and the anchor on that page is named anchor1
, the resulting value of the hyperlink's url
property is /faces/Page2.jsp#anchor1
.