Link

Definition

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. The link control can be for client side eventing. See the EventValidationComponent description for more details.

  • enabled - inherited from EventValidationComponent .

    A boolean value that enables (=true) or disables (=false) the link control. A disabled link has a different text color to show the user that it is disabled and sends no event when clicked.

  • fontSize

    Sets the font size for the link.

  • id

    Identification name of the link.

  • jsObjectNeeded - inherited from Component .

    A boolean value that defines if a JavaScript object has to be generated for the link component.

  • labeled

    Enables or disables the notification when the control has a label assigned to it.

  • linkDesign

    Design definition of the link.

    • DRAGRELATE

      In link color and underlined. On "MouseOver" color different, no underline

    • DRILLDOWN

      In link color and underlined. On "MouseOver" link color brighter and underlined. "Standard" link display.

    • FUNCTION

      In link color and underlined. On "MouseOver" link color brighter and underlined. "Standard" link display.

    • REPORTING

      In link color, no underline. On "MouseOver" link color brighter and underlined.

    • RESULT

      In text color, no underline. On "MouseOver" link color brighter and underlined.

  • onClick

    Defines the event handling method that will be processed when the user clicks on the link. If 'onClick' is specified, the event handling routine is called.

  • onClientClick

    Defines the JavaScript fragment that is executed when the user clicks on the link. If both events ('onClick' and 'onClientClick') are specified, the 'onClientClick' event handling method is activated first. By default the 'onClick' event handling method is activated afterwards. In the JavaScript fragment you can cancel the activation of the 'onClick' event handling method with the command

    htmlbevent.cancelSubmit=true;

    The 'onClientClick' event is useful to preprocess the form and only send the form to client if the preprocessing was successful (for example, date validation, valid number format etc.) to save client/server interaction.

  • 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.

Attributes

M

Values

Usage

enabled*

 

FALSETRUE (d)

Taglib No tag available

Classlib setEnabled (true)

fontSize

   

Taglib No tag available

Classlib setFontSize (LinkFontSize.fontsize)

id

*

String (cs)

Taglib id="importantItems"

Classlib setId("importantItems")

jsObjectNeeded**

 

FALSE (d) TRUE

Taglib No tag available

Classlib setJsObjectNeeded (true)

labelled

 

FALSE (d) TRUE

Taglib No tag available

Classlib setLabeled (true)

linkDesign

 

DRAGRELATEDRILLDOWN (d) FUNCTIONREPORTINGRESULT

Taglib linkDesign="RESULT"

Classlib setLinkDesign(LinkDesign.RESULT)

reference

 

String

Taglib reference="http://www.sap.com"

Classlib setR eference("http://www.sap.com")

target

 

_blank_self (d) _parent_top

Taglib target="_TOP"

Classlib setTarget("_TOP")

text

 

String

Taglib text="To the beach"

Classlib setText("To the beach")

tooltip

 

String

Taglib tooltip="Enjoy and relax"

Classlib setTooltip("Enjoy and relax")

* Method is inherited from the EventValidationComponent component. Therefor the attribute is different between the taglib and the classlib.

** Method is inherited from the Component component.

See the JavaScript API description for details how to access the component in JavaScript.

Events

M

Values

Usage

onClick

 

String (cs)

Taglib onClick="ProcessLink"

Classlib setOnClick("ProcessLink")

onClientClick

 

String ( c s)

Taglib No tag available

Classlib setOnClientClick ("alert('Click') " )

Example

Text as link using the taglib

<hbj:linkid= "link1" text= "Linktogoogle" reference= "http://www.google.com" target= "_TOP" tooltip= "thistakesyouto:http://www.google.com" onClick= "LinkClick" />

Text as link using the classlib

Formform=(Form) this .getForm();Linklink= new  Link( "myLink" );link.setTarget( "_TOP" );link.setReference( "http://www.google.com" );link.setTooltip( "thistakesyouto:http://www.google.com" );link.addText( "Linktogoogle" ); form.addComponent(link);

Result

Link to google

Image as link (and getting the resource path once - at the beginning of the JSP. This is useful when the JSP uses several images) using the taglib

<%--Getresourceurlofcomponent--%><%StringImageURL=componentRequest.getPublicResourcePath()+ "/../mimes/" ;%><hbj:linkid= "link1" text= "" reference= "http://www.sap.com" target= "_TOP" tooltip= "thistakesyouto:http://www.sap.com" onClick= "LinkClick" <hbj:imagesrc= "<%=ImageURL+\"sap.gif\"%>" alt= "Imagenotavailable" /></hbj:link>

Result

Text and Image as link (and getting the resource path at the control) using the taglib

<%@pageimport= "com.sapportals.portal.prt.resource.IResource" %> . . <hbj:linkid= "link1" text= "LinktoSAP" reference= "http://www.sap.com" target= "_TOP" tooltip= "thistakesyouto:http://www.sap.com" onClick= "LinkClick" ><hbj:imageid= "image_logo" alt= "Imagenotavailable" src= "" ><%IResourcers=componentRequest.getResource(IResource.IMAGE, "../mimes/sap.gif" );image_logo.setSrc (rs.getResourceInformation().getURL(componentRequest));%></hbj:image> </hbj:link>

Result

Link to google