0

in my JSF application i created a database and on every templated page i want to show and image at the top and use css to center it. My problem is though, the image wont show up instead alt="Header" prints out.

This is my code:

<?xml version='1.0' encoding='UTF-8' ?> 
<!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://xmlns.jcp.org/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html">
    <h:head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title><ui:insert name="title">Default Title</ui:insert></title>
    </h:head>

    <h:body>
        <img src="images/GymHeader.png" alt="Header" /> -------------Problem code.
        <h1>
            <ui:insert name="title">Default Title</ui:insert>
        </h1>
        <p>
            <ui:insert name="body">Default Body</ui:insert>
        </p>
    </h:body>

</html>

The path name is perfect. Thanks for the help in advance...

  • Your path is wrong. what is the complete path of the image in your source directory. – erencan Dec 04 '13 at 13:55
  • go through http://stackoverflow.com/questions/11988415/what-is-the-jsf-resource-library-for-and-how-should-it-be-used – Johny T Koshy Dec 04 '13 at 14:05
  • Please answer those 2 questions: 1) What's the full URL as you see in browser's address bar when you open the page containing the image? 2) What's the full URL as you see in browser's address bar when you download the image individually? Once you have the answer to both, you can easily extract the relative image URL from the absolute page URL. – BalusC Dec 04 '13 at 15:02

1 Answers1

1

if you have images in your webapp/resources folder then you should use <h:graphicImage name="images/GymHeader.png"/>

bsmk
  • 1,307
  • 1
  • 14
  • 26