如何删除JSP中EL标记生成的多余空格?

时间:2017-01-22 17:43:45

标签: java html jsp el

这个想法是打印每本书的作者并在每个作者之间添加一个逗号。生成的HTML会增加大量的空白区域,这会在逗号和下一个名称之间创建一个空格。见截图。我正试图消除多余的空间。

<div class="row">
    <div class="col-md-12">
        <c:forEach items="${book.authors}" var="author" varStatus="loop">
            ${author.firstName} ${author.middleInitials} ${author.lastName}
            <c:choose>
                <c:when test="${author.postNominalInitials != null}">
                    ${author.postNominalInitials}
                </c:when>
            </c:choose>
            <c:if test="${!loop.last}">,</c:if>
        </c:forEach>
    </div>
</div>

目标是删除每个作者姓名后的空格(并最终用'和'替换最后一个逗号)

enter image description here

以下是Google检查员的读数,我看到其中添加了额外的空白区域。

enter image description here

感谢您的帮助!

0 个答案:

没有答案
相关问题