<td align="center" title="${entity.newsTitle }" style="max-width: 100px;overflow: hidden; text-overflow:ellipsis;white-space: nowrap">
${entity.newsTitle }
</td>
title标签体是 鼠标在td标签上显示 文本内容
style具体的就是设置最大的宽度,多余的隐藏,多余的会以“......”
demo2:效果和上面差不多 只是不再局限于td标签中使用了
使用jstl标签
<c:choose>
<c:when test="${!empty entity.bannerText && fn:length(entity.bannerText)> 10}">${fn:substring(entity.bannerText, 0, 10)}...</c:when>
<c:otherwise>${entity.bannerText}</c:otherwise>
</c:choose>