字段内容过长,设定显示字节过长的用"....."代替

字段内容过长,设定显示长度的用"....."代替算法

1.使用s:if标签方法
<s:iterator value="List" var="item" status="st">
布局

  ........................................spa

<tr>对象

  <td >
  <div id="electaccountno" >ip

 

    <s:if test="#item.ELECTACCOUNTNO.length()>22">
    <s:property value="#item.ELECTACCOUNTNO.substring(0,22)"/>...</s:if>
    <s:else><s:property value="#item.ELECTACCOUNTNO"/></s:else> --%>
    
    </div>
  </td>string

 

</tr>it

</s:iterator> table

注:s标签遍历List显示22长度的内容后用“....”代替。test

2.使用s:if标签方法List

table{ table-layout:fixed;    /* 必须定义表格的布局算法为fixed,td的定义才能起做用。 */}td{ width:100%; word-break:keep-all;     /* 不换行 */ white-space:nowrap;    /* 不换行 */ overflow:hidden;       /* 内容超出宽度时隐藏超出部分的内容 */ text-overflow:ellipsis;   /* 当对象内文本溢出时显示省略标记“....” */}

相关文章
相关标签/搜索