1.搜索的高亮显示方法,采用java的String.repalceAll(oldString,newString);方法达到页面高亮显示的目的,原理就是给关键字加上+"关键字"+
public String higiLight(String content,String regions,String persons,String companys)
{
String newregions=""+regions+"";
String newpersons=""+persons+"";
String newcompanys=""+companys+"";
content=content.replaceAll(regions, newregions);
content=content.replace(persons, newpersons);
content=content.replace(companys, newcompanys);
return content;
}
2.通过Struts对象传值到前台,需要使用escape="false"原理是:Struts2 数据标签要转义才能显示的HTML格式
3.Struts截取字符串方式是 //从0-100截取字段,用jstl标签
uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
${fn:substring("name"),beginIndex,endIndex}