According to this link:
How to create a custom Facelets tag?
I was able to create a facelet tag files.
A part of my CustomGraphicImage.xhtml file:
<h:graphicImage style="border: #{border}px solid #000000" height="#{height}" width="#{width}" alt="#{alt}" library="image" name="#{value}" />
My test.xhtml file:
<my:ImgPath border="1" value="loading_pt01.gif"></my:ImgPath>
The problem is that when view HTML source code, undefined attributes still appear. In the below example, undefined tags are alt, height, width
.
<img src="/demo-project/javax.faces.resource/loading_pt01.gif.xhtml?ln=image" style="border: 1px solid #000000" alt height width>
How can I display only defined attributes?
I'm thinking about using <c:if>
to decide to whether display the attributes or not but that seems too much work.