Thursday, July 29, 2010

OL snipped (valid HTML from your JSP components, PLEASE !)

many component authors are lazy to read HTML specification,
and lazy to write extra if in the code as well.
One of the examples is title tag absence in code generated by
myfaces components (see older posts).
Proposal for correct list rendering:

<c:if test="${!empty files}">
<ol>

<c:forEach var="file" items="${files}">
<li><c:out value="${file.name}"/></li>
</c:forEach>
</ol>
</c:if>

The point is that OL without child LI is nonsence from HTML point of view.
Later we will talk about what element
to generate instead for empty list
and if null and empty is the same (EL does not care of course).

No comments:

Post a Comment