When I search by some Keyword
I want display the result and Highlight me keyword for example:
Keyword: Java
"Java" display different from rest text
any way: strong or change color ...etc
my code use <c:forEach to display the result
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
When I search by some Keyword
I want display the result and Highlight me keyword for example:
Keyword: Java
"Java" display different from rest text
any way: strong or change color ...etc
my code use <c:forEach to display the result
Hello Mohd,
Have you already coded the search function?
You just need to insert HTML tags before and after the keyword.
<strong><font color="red">JAVA</font></strong>
If you post your code here then ill see if I can help add it.
Please use [highlight=Java] code [/highlight] tags when posting your code.
Forum Tip: Add to peoples reputation by clicking the button on their useful posts.
<c:forEach var="book1" items="${bookList}"> <tr> <td> <c:url var="listThreadsUrl" value="BookDetailsServlet"> <c:param name="id" value="${book1.id}"/> </c:url> <a href='<c:out value="${listThreadsUrl}"/>'> ${book1.title} </a> </tr> </c:forEach>
the keyword forward from jsp page to servlet to perform query and finaly to other jsp page
and here display the result
my result is " book1.title "
if you search for Java
may will find "Java How to Program"
Java here should be different
There is solution by using javascript
I found this one
Search Engine Keyword Highlight with Javascript | SYP
but I didn't know how to use it in jsp