2

Follow-up to How to embed SVG graphics properly in JSF application using OmniFaces

I'm using the OmniFaces 2.1 snapshot in order to output SVG files from byte[] arrays. I need to suffix #a on SVG URL's in order to activate a CSS style inside the SVG.

Example img:

<img src="/web/javax.faces.resource/ApplicationBean_getImageById_svg.xhtml?ln=omnifaces.graphic&amp;v=0&amp;p=106.1%23a">

As you can see, my #a is appended at the right side of the URL as %23a.

If this had been a regular URL it would be

<img src="106.1.svg#a" />

It would then pick the CSS style and, in my case, paint the background of this sign yellow.

I'm really hoping BalusC comes to my rescue here. Heh. :)

4

1 回答 1

1

根据这个提交<o:graphicImage>得到了一个新fragment属性。这应该使您能够通过 URL 片段标识符传递 SVG 视图模式。它在今天的2.1 SNAPSHOT中可用。

例如

<o:graphicImage value="#{bean.svg(imageId)}" 
    type="svg" fragment="svgView(viewBox(0,200,1000,1000))" />
于 2015-03-18T08:47:16.190 回答