解决方案 »

  1.   

    <s:if test="#em.open_id.length()>10">
    <s:property value="#em.open_id.substring(0,10)" />
    </s:if>
    <s:else>
    <s:property value="#em.open_id />
    </s:else>
      

  2.   

    <s:if test="#em.open_id.length <=10">
        <s:property value="#em.open_id" />
    </s:if>
    <s:elseif test="#em.open_id.length >10">
        <s:property value="#em.open_id.substring(0,10)"/>
    </s:elseif>
      

  3.   

    这种功能用服务端标签效率太低了,相当于在action中执行if else逻辑建议用jquery前端框架,javascript处理即可,除非你前端页面要求性能很高,服务端返回数据量不能太多
      

  4.   

    我是从后台传过来的数据,而且还是集合,怎么在jquery里面操作尼
      

  5.   

    可以尝试把数据组织成json格式,在页面通过js操作,或者是直接通过样式来截取字符串长度 还能自动添加省略号