<div>
プレーンな HTML要素の属性を条件付きでレンダリングしたいと思います。私は以下のように試しました<c:if>
:
<ui:composition
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<div data-product-id="#{ID}"
<c:if test="${not empty testvalue1}">
data-test1-for="#{testvalue1}"
</c:if>
<c:if test="${not empty testvalue2}">
data-test2-for="#{testvalue1}"
</c:if>
>
div content
</div>
</ui:composition>
ただし、Facelet 例外が発生しました。
com.sun.facelets.FaceletException: Error Parsing /assets/template/module/container/product/product-marker.xhtml: Error Traced[line: 9] 要素タイプ「div」の後に属性指定「">」が必要ですまたは「/>」
<div>
プレーンな HTML要素の属性を条件付きでレンダリングするにはどうすればよいですか?