后台代码
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>"); }
时间: 2024-10-27 09:16:46