How to embed SVG graphics properly in JSF application using OmniFaces
的后续行动我正在使用OmniFaces 2.1快照来从byte []数组输出SVG文件。我需要在SVG URL上加上 #a 后缀,以激活SVG中的CSS样式。
示例img:
<img src="/web/javax.faces.resource/ApplicationBean_getImageById_svg.xhtml?ln=omnifaces.graphic&v=0&p=106.1%23a">
如您所见,我的 #a 会在网址的右侧附加为%23a 。
如果这是常规网址,则为
<img src="106.1.svg#a" />
然后它将选择CSS样式,在我的情况下,将此符号的背景绘制为黄色。
我真的希望BalusC来这里救援。嘿。 :)
答案 0 :(得分:1)
根据this commit,<o:graphicImage>
获得了新的fragment
属性。这可以让您通过SVG view modes via URL fragment identifier。它可以在今天的2.1 SNAPSHOT中找到。
E.g。
<o:graphicImage value="#{bean.svg(imageId)}"
type="svg" fragment="svgView(viewBox(0,200,1000,1000))" />