Is nesting a c:out JSTL tag inside an element attribute a good practice or is using the var attribute of c:out generally preferred? It seems to work either way, but I suspect nesting it might not work in some application servers or versions of JSP (and it just looks wrong).
For example, an input element which has its value restored on validation failure, and with special character escaping:
<input type="text" name="firstname" value="<c:out value="${param.firstname}"/>"/>
versus:
<c:out value="${param.firstname}" var="firstname"/>
<input type="text" name="firstname" value="${firstname}"/>
The common practice to prevent XSS attacks in HTML element attributes without disturbing the well formed XML syntax by a nested
<c:out>tag is usingfn:escapeXml()function instead: