之因此在td中的文字不換行,是由於在解析爲前臺數據的時候,把後臺傳過來的值轉義了,因此須要手動轉換過來,能夠以下:javascript
JSP:html
<s:iterator value="list" var="r"> <td style="text-align:left;vertical-align:middle;" class="company"> <s:property value="company"/> </td> </s:iterator>
JS:java
$(function(){ var $array = $('.company'); for(var i = 0;i < $array.length;i++){ var html = $($array[i]).html(); //從後臺返回數據到前臺的時候,"<"會被轉化爲"<",">"會被轉化爲">",這裏再轉回來 html = html.replaceAll("<","<").replaceAll(">",">"); $($array[i]).html(html); } });