 |
Control API for Link (link)
Defines a link to another page. The text of the link becomes an underline
and is displayed in a different color. An image can be defined as link
as well - see the example for details.
- id
Identification name of the link.
- onClick
Defines the action that will be processed
when the user clicks on the link. If 'onClick' is specified, the event
handling routine is called.
- reference
Specifies the address of the page/document
to be opened. If the 'onClick' attribute is defined the event handling
routine is started and the 'reference' string is handed to the event
handling routine. The referenced document is not opened - the event
handling routine has to do that.
If the 'onClick' attribute is not defined, the link is opening the referenced
document.
- target
Specifies the name of the frame where
the document is to be opened. The following values refer to w3c HTML-standard.
- _blank
The web client should load the designated document in a new, unnamed
window.
- _self
The web client should load the document in the same frame as the
element that refers to the target.
- _parent
The web client should load the document into the immediate FRAMESET
parent of the current frame. This value is equivalent to _self if
the current frame has no parent.
- _top
The web client should load the document into the full, original
window (thus canceling all other frames). This value is equivalent
to _self if the current frame has no parent.
- text
A text string that is displayed underlined
and in different color. If no 'text' attribute is provided or a the
'text' attribute is set to an empty string, the link is not displayed.
- tooltip
Defines the hint of the link which
is displayed as the mouse cursor passes over the link,
or as the mouse button is pressed but not released.
| attribute |
req. |
values |
default |
case sens. |
JSP taglib |
classlib |
| id |
yes |
String |
none |
yes |
id="ImportantItems" |
|
| reference |
no |
String |
none |
no |
reference="http://www.sap.com" |
setReference("http://www.sap.com") |
| target |
no |
_blank
_self
_parent
_top |
_self |
no |
target="_TOP" |
setTarget("_TOP") |
| text |
no |
String |
none |
no |
text="To the
beach" |
addText("To the
beach") |
| tooltip |
no |
String |
none |
no |
tooltip="Enjoy
and relax" |
setTooltip("Enjoy
and relax") |
| events |
req. |
values |
default |
case sens. |
JSP taglib |
classlib |
| onClick |
no |
String |
none |
yes |
onClick("ProcessLink") |
setOnClick("ProcessLink") |
Example - Text as link
<hbj:link
id="link1"
text="Link to google"
reference="http://www.google.com"
target="_TOP"
tooltip="this takes you to: http://www.google.com"
onClick="LinkClick"
/>
Result
Link to google
Example - Image as link (and getting the resource path once -
at the beginning of the JSP. This is useful when the JSP uses several
images)
<%-- Get resource url of component --%> <% String ImageURL = componentRequest.getPublicResourcePath() + "/images/"; %>
<hbj:link
id="link1"
text=""
reference="http://www.sap.com"
target="_TOP"
tooltip="this takes you to: http://www.sap.com"
onClick="LinkClick"
<hbj:image src="<%= ImageURL+\"sap.gif\" %>" alt="Image not available" /> </hbj:link>
Result

Example - Text and Image as link (and getting the resource path
at the control)
<%@ page import="com.sapportals.portal.prt.resource.IResource" %> .
.
<hbj:link
id="link1"
text="Link to SAP"
reference="http://www.sap.com"
target="_TOP"
tooltip="this takes you to: http://www.sap.com"
onClick="LinkClick" >
<hbj:image id="image_logo" alt="Image not available"
src="" >
<% IResource rs = componentRequest.getResource(IResource.IMAGE, "images/sap.gif"); image_logo.setSrc(rs.getResourceInformation().getURL(componentRequest)); %>
</hbj:image> </hbj:link>
Result
Link to SAP
|
|