In trying to clean up some pretty crufty code I rewrote something this way:
<jsp:element name="img">
<jsp:attribute name="src">
<c:url value="${akamai}/images/prdLargerImage.gif"/>
</jsp:attribute>
<jsp:attribute name="alt">Zoom Image</jsp:attribute>
</jsp:element>
…but was surprised to discover that JSP generated this code:
<img src="/images/prdLargerImage.gif" alt="Zoom Image">
</img>
Is there any way to force it to generate <img src="/images/prdLargerImage.gif" alt="Zoom Image"/>?
You can configure the container to trim that whitespace away by the following entry in
web.xml:There’s nothing you can do against having a dangling
</img>instead of a short tag<img/>.However, if you target a Servlet 2.4 / JSP 2.0 compatible container (where EL in template text is supported), I’d rather just rewrite that piece of ugliness (which offers imo totally no extra advantages) like follows: