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

  • Home
  • SEARCH
  • 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 3615888
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T22:25:47+00:00 2026-05-18T22:25:47+00:00

What I want to do is create web pages with interactive SVG content. I

  • 0

What I want to do is create web pages with interactive SVG content. I had this working as a Java desktop application using Batik to render my SVG and collect UI events like mouseclick. Now I want to use those SVG graphics files in my JSF (Primefaces) web application in the same way.

Trying to get started, I found this didn’t work:

<h:graphicImage id=”gloob” value=”images/sprinkverks.svg”
alt=”Graphic Goes Here”/>

I don’t mind doing some reading to get up the learning curve. It was just a bit surprising that some google searches didn’t turn up anything useful.

What I did find suggested that I would have to do this with the f:verbatim tag as if I were hand-coding the HTML. I would then have to add some script to capture the SVG events and feed them back into the AJAX code. If I have to do all that I will, but I was hoping there would be an easier and automated way.

So the questions are:

  1. How to get the image to render in the first place?
  2. How to get the DOM events from the SVG portion of the page back to the backing beans?

Much thanks for any pointers.

  • 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-18T22:25:48+00:00Added an answer on May 18, 2026 at 10:25 pm

    How to get the image to render in the first place?

    The <h:graphicImage> just renders a HTML <img> element. This doesn’t work for SVG objects in current browsers. You need <object type="image/svg+xml">. Since JSF 1.2, there’s no need for the <f:verbatim> ugliness. On Facelets you can just inline EL in plain HTML like so:

    <object type="image/svg+xml" data="#{bean.svgUrl}">
    

    The standard JSF implementation however doesn’t offer an UI component which renders an <object>, so you have got to do it the plain vanilla HTML way. I’ve checked at PrimeFaces, OpenFaces and RichFaces, but no one offer a component yet which is targeted on embedding SVG objects. PrimeFaces has a <p:media> and RichFaces an <a4j:mediaOutput> for movie objects, but that’s it.


    How to get the DOM events from the SVG portion of the page back to the backing beans?

    Your best bet is to write some JavaScript which delegates to a hidden JSF ajax form. Write the necessary data to the hidden fields and trigger the <f:ajax> change or action. You can find a similar example in this answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a Java application bundle for Mac without using Mac. According
I want to test the web pages I create in all the modern versions
I want to create a Web application by combining Joomla CMS with Spring Framework.
I want to create a client side mail creator web page. I know the
I want to create fixed status bar in by web form to display various
I've created an web authentication app using c# & asp.net and want to bounce
I'm working on a internal web application (only employees can log in) and need
What I want to do is to create a web page for every user
I have a wordpress website, and I want to create a simple web commerce.
I want to create some html help pages, separate html pages. However, I want

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.