Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6349001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:31:46+00:00 2026-05-24T21:31:46+00:00

According to the JSF 2.0 specification, there are three ways to use h:graphicImage depending

  • 0

According to the JSF 2.0 specification, there are three ways to use h:graphicImage depending on the way by which JSF generates the “src” attribute of the HTML tag:

<h:graphicImage value="#{resource['images:next.gif']}"/>

<h:graphicImage library="images" name="next.gif"/>

<h:graphicImage url="/resources/images/next.gif"/>

The specification states that the first two should render exactly the same markup. In my JSF implementation (MyFaces 2.0.2), here is the output HTML that is generated:

<img src="/AppName/faces/javax.faces.resource/next.gif?ln=images">

<img src="/AppName/faces/javax.faces.resource/next.gif?ln=images">

<img src="/AppName/resources/images/next.gif">

So it seems that if I use (name, library) or (value) attributes, the image is always going to be streamed to the client by JSF’s servlet. If I use (url) attribute, I can give direct link to the resource with no servlet intervention.

For me, the second approach – direct server URL to resource, is faster.

In what cases the first approach – specifying (name, library) or (value) attributes, be used?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T21:31:47+00:00Added an answer on May 24, 2026 at 9:31 pm

    For me, the second approach – direct server URL to resource, is faster.

    The difference should be totally negligible. The "direct server URL to resource" approach also uses a servlet (the default servlet which is provided by the container). Please show your benchmark results.


    In what cases the first approach – specifying (name, library) or (value) attributes, be used?

    It allows you for serving the resources from within a JAR file. It also allows you for a nicer way of dynamically switching the library in the following manner:

    <h:graphicImage library="#{user.prefs.looknfeel}" name="next.gif"/>
    

    The library should actually point to a common resource library with all CSS/JS/images, not to a specific "images" library.

    Related questions:

    • How to reference JSF image resource as CSS background image url
    • Changing JSF prefix to suffix mapping forces me to reapply the mapping on CSS background images
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi i am trying to use following technologies together: JSF 2.1.0 ICEFaces 2.0.2 which
According to the documentation, they're pretty much interchangeable. Is there a stylistic reason to
According to what I have found so far, I can use the following code:
According to Steffen's post this is an efficient way to generate random BOOL s
While developing a web application in JSF, I came across an expression which was
According to the dataset specification , how is element.dataset meant to delete data attributes?
I got this error which according to Apache Support is an issue relating with
I'm using Tomahawk12-1.1.10 with Mojarra JSF 1.2_04 . When I try to use: <t:dataList
According to the answers in this comparison question , there's no technical difference between
I have a web app which runs on JSF 2.0 + Richfaces 3.3.3. Looks

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.