How to highlight a specific word ina String in JSP

sharkom

New Member
I have a JSP where in a text area i am reading the String array of a whole sentence and printing it line by line. No i want to highlight some patter in the line in BOLD and red color font. e.g. if the line which is being read contains pattern "error" (it can be a single word or a part of a word like "initializationerror" or ""), i t will be highlighted in BOLD and red color. The rest of the line will be print as it is.Below is the code snippet:\[code\]<table border="2"><% if(session.getAttribute("Result") != null) { String Result = (String) session.getAttribute("Result"); if(Result.length() != 0) { String[] split_EOL = Result.split("\n");%> <tr align="center"> <td> // Text area start here <textarea rows="50" cols="100" readonly="yes"> <% for(int i = 0; i < split_EOL.length; i++) { out.println(split_EOL); out.println(" "); }%> </textarea> </td> </tr><% } }%></table>\[/code\]Please help
 
Back
Top