JavaServer Faces (JSF) - JSF Basic Tags - JSF h:graphicImage - JavaServer Faces (JSF)

What is JSF h:graphicImage?

The h:graphicImage tag renders an HTML element of the type "img".

JSF Tag

Rendered Output

Tag Attributes

S.No
Attribute & Description
1
id
Identifier for a component
2
binding
Reference to the component that can be used in a backing bean
3
rendered
A boolean; false suppresses rendering
4
styleClass
Cascading stylesheet (CSS) class name
5
value
A component’s value, typically a value binding
6
alt
Alternative text for nontextual elements such as images or applets
7
dir
Direction for text. Valid values areltr(left to right) andrtl(right to left)
8
lang
Base language of an element’s attributes and text
9
style
Inline style information
10
tabindex
Numerical value specifying a tab index
11
target
The name of a frame in which a document is opened
12
title
A title, used for accessibility, that describes an element. Visual browsers typically create tooltips for the title’s value
13
usemap
Usemap of an element
14
url
Url of the image
15
width
Width of an element
16
onblur
Element loses focus
17
onchange
Element’s value changes
18
onclick
Mouse button is clicked over the element
19
ondblclick
Mouse button is double-clicked over the element
20
onfocus
Element receives focus
21
onkeydown
Key is pressed
22
onkeypress
Key is pressed and subsequently released
23
onkeyup
Key is released
24
onmousedown
Mouse button is pressed over the element
25
onmousemove
Mouse moves over the element
26
onmouseout
Mouse leaves the element’s area
27
onmouseover
Mouse moves onto an element
28
onmouseup
Mouse button is released

Example Application

A test JSF application is created to test the above tag.

Step
Description
1
Create a project with a namehelloworldunder a packagecom.wisdomjobs.com.testas explained in theJSF - First Applicationchapter.
2
Modifyhome.xhtmlas explained below. Keep rest of the files unchanged.
3
Compile and run the application to make sure business logic is working as per the requirements.
4
Finally, build the application in the form of war file and deploy it in Apache Tomcat Webserver.
5
Launch your web application using appropriate URL as explained below in the last step.

home.xhtml

Once all the changes are done, the application is compiled and run as in JSF – Create Application chapter. On successful creation of the application, the result appears as:

JSF GraphicImage

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

JavaServer Faces (JSF) Topics