Getting started with SVG graphics objects in JSF 2.0 pages.

Posted by AlanObject on Stack Overflow See other posts from Stack Overflow or by AlanObject
Published on 2010-12-25T01:49:38Z Indexed on 2010/12/25 1:54 UTC
Read the original article Hit count: 515

Filed under:
|

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.

© Stack Overflow or respective owner

Related posts about svg

Related posts about jsf-2.0