• Menu
  • Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

JavaBeat

Java Tutorial Blog

  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us
  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us

JSF 2 GraphicImage Example

March 21, 2014 //  by Amr Mohammed

JavaServer Faces (JSF 2) provides a number of user interfaces components that cover the most common requirements, one of the most important component is a <h:graphicImage/> component. The graphicImage component renders an HTML image tag. This tag renders the HTML “img” element. If you are looking for the configuration of complete application, please read our JSF 2 Setup Tutorial.

Also Read:

  • JSF 2 Tutorials
  • JSF Tutorials
  • Introduction to JSF

1. The Views

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core">
	<h:graphicImage value="/resources/images/jvmhost.png" width="80px" height="80px"/>
</html>
  • The graphicImage component accept a value that reference the path of an image.
  • The image that the graphicImage referenced is located under resources/images folder.

2. Images Folder

In the JSF 2 application you have the ability to add an images folder under the context root of your web application. The below snapshot will show you the real location of the images that being used.

JSF 2 GraphicImage Example 1

3. JSF 2 GraphicImage Demo

The below snapshot will show you a running sample of GraphicImage example.

JSF 2 GraphicImage Example 2

Category: JSFTag: JSF 2

About Amr Mohammed

Previous Post: « JSF 2 OutputFormat Example
Next Post: JSF 2 TextArea Example »

Primary Sidebar

Follow Us

  • Facebook
  • Pinterest

FEATURED TUTORIALS

How to Use Math.min() Method in Java?

What is new in Java 6.0 Collections API?

The Java 6.0 Compiler API

Introductiion to Jakarta Struts

What’s new in Struts 2.0? – Struts 2.0 Framework

JavaBeat

Copyright © by JavaBeat · All rights reserved
Privacy Policy | Contact