Dmi*_*try 6 image alt jsf-2 glassfish-3
我有一个jsf片段:
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets">
<!-- Yandex.Metrika -->
<img src="//mc.yandex.ru/watch/xxx" alt=""/>
<!-- /Yandex.Metrika -->
</ui:composition>
Run Code Online (Sandbox Code Playgroud)
但是当我使用它时,web-client在img元素中获取HTML页面而没有空的alt属性:
<!-- Yandex.Metrika -->
<img src="//mc.yandex.ru/watch/xxx" />
<!-- /Yandex.Metrika -->
Run Code Online (Sandbox Code Playgroud)
结果我的文档有验证错误(
我怎么解决这个问题?
您可以使用 JSF GraphicImage 组件,它会呈现空的 alt 属性。
例如:
<h:graphicImage value="#{resource['images:image1.png']}" alt="" />
Run Code Online (Sandbox Code Playgroud)
或者
<h:graphicImage value="http://somedomain.com/somecontext/xxx/image1.png" alt="" />
Run Code Online (Sandbox Code Playgroud)