后台
public static String replaceBlank(String str) {
String dest = "";
if (str!=null) {
Pattern p = Pattern.compile("\s*| |
|
");
Matcher m = p.matcher(str);
dest = m.replaceAll("");
}
return dest;
}
$(function(){
<c:forEach var="item" items="${view }" varStatus="i">;
$("#content"+${item.bh }).html(insertEnter("${item.content }",60));
$("#x"+${item.bh }).html(insertEnter("${item.work_log.knowledge }",50));
</c:forEach>
});
function insertEnter(str,n){
var len = str.length;
var strTemp = '';
if(len > n){
strTemp = str.substring(0,n);
str = str.substring(n,len);
return strTemp+'<br />'+insertEnter(str,n);
}else{
return str;
}
}
提示