我用JSP和sql server2005做了一个查询系统,想以表格的方式显示查询结果,但其中有一个字段的内容很长,单元格显示很不美观,请问能用什么方法将其在单元格显示时到达指定的宽度后自动在单元格内换行?

解决方案 »

  1.   

    <TABLE style="word-wrap: break-word; word-break: break-all;">
    加上这个试试
      

  2.   

    可以判断一下长度,太长了就截取前面一部分,后面用省略号,比如:
    <c:if test="${fn:length(list.name)>20}">${fn:substring(list.name,0,20)}...</c:if>
    <c:if test="${fn:length(list.name)<=20}">${list.name }</c:if>
      

  3.   

    像这样:<td width="10px">
    还不清楚加我群号:88531017
      

  4.   

    subString截取吧。
    其他的我都测试了,不好使。<c:if test="${fn:length(list.name)>20}">${fn:substring(list.name,0,20)}...</c:if>
    <c:if test="${fn:length(list.name)<=20}">${list.name }</c:if>