显示关键字泛红
<% String search = null; String stu = request.getParameter("stu"); String select_stu = request.getParameter("select_stu"); select_stu=new String(select_stu.getBytes("ISO-8859-1"),"utf-8"); if ("Xno".equals(stu)) { search = (String) request.getAttribute("s_no"); // 显示的内容 } else if ("Xname".equals(stu)) { search = (String) request.getAttribute("s_name"); // 显示的内容 } else if ("Xmajor".equals(stu)) { search = (String) request.getAttribute("s_major"); // 显示的内容 } String searchWord = select_stu; //要替换的关键词 search = search.replaceAll(searchWord, "<font color='#FF0000'>" + searchWord + "</font>");// 从search 中找到 searchWord 把他替换 %> <%=search%>
HLb`s签名:给自己一个拼搏的理由,好好的坚持下去。