后台代码
List<Notice> nlist= query.list(); for(Notice notice:nlist){ notice.setTitle(notice.getTitle().replaceAll(keyword,"<font color='red'><B>" + keyword + "</B></font>")); }
参考文章:
http://bbs.csdn.net/topics/260004056
if (key != null) { name = name.replaceAll(key,"<font color='red'>" + key + "</font>"); content = content.replaceAll(key,"<font color='red'>" + key + "</font>"); }
本文出自 “点滴积累” 博客,请务必保留此出处http://tianxingzhe.blog.51cto.com/3390077/1679733