Getting started with SVG graphics objects in JSF 2.0 pages

前端 未结 2 560
迷失自我
迷失自我 2021-01-01 01:40

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

2条回答
  •  爱一瞬间的悲伤
    2021-01-01 02:05

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

    The just renders a HTML element. This doesn't work for SVG objects in current browsers. You need . Since JSF 1.2, there's no need for the ugliness. On Facelets you can just inline EL in plain HTML like so:

    
    
    
    

    The standard JSF implementation however doesn't offer an UI component which renders an , 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 and RichFaces an 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 change or action. You can find a similar example in this answer.

    提交回复
    热议问题