Control API for Image (image)

Displays a bitmap in GIF or JPEG format. The width and height of the image can be specified.

  • alt
    Defines an alternative text for the 'src' attribute. If the 'src' bitmap cannot be found or opened (e.g. unrecognized graphic format) the 'alt' text is displayed with an red X in front of it and surrounded by a frame indicating the bitmap size.
  • height
    Defines the height of the bitmap. If 'height' is omitted the height of the image is determined by the bitmap itself.
  • id
    Identification name of the image.
  • src
    Name of bitmap (=source). The name of the bitmap is case sensitive. The images are usually stored in the public resource path of the component in the subfolder /images. The public resource path can be determined with the JSP command:
  • <% String PublicURL = componentRequest.getPublicResourcePath(); %>
    You can also get the complete path to image include the subfolder /image with the command:
    <% String ImageURL = componentRequest.getPublicResourcePath() + "/images/"; %>

    Hint: We use the string variable ImageURL in following table to demonstrate the setting of the src attribute.

Another possibility is to get the complete URL of the image and set the src attribute in a scriptlet.

    <%
    IResource rs = componentRequest.getResource(IResource.IMAGE, "images/mypicture.gif");
    image.setSrc(rs.getResourceInformation().getURL(componentRequest));
    %>

  • tooltip
    Defines the hint of the image which is displayed as the mouse cursor passes over the image, or as the mouse button is pressed but not released.
  • width
    Defines the width of the bitmap. If 'width' is omitted the width of the image is determined by the bitmap itself.
attribute req. values default case sens. JSP taglib classlib
alt yes String none no alt="picture not found" setAlt("picture not found")
height no Unit bitmap height no height="150" setHeight("150")
id yes String none yes id="Hometown"  
src yes String none yes src="<%= ImageURL +\"walldorf.jpg\" %>" setSrc(ImageUrl + "walldorf.jpg")
tooltip no String none no tooltip="center of ebiz" setTooltip("center of ebiz")
width no Unit bitmap width - width="300" setWidth("300")

 

Example
<hbj:image
           id="Logo"
           tooltip="center of ebiz"
           width="70"
           height="35"
           src="<%= ImageURL +\"saplogo.gif\" %>"
           alt="picture saplogo.gif not found"
/>

Result