What you want to do is convert user entered text into HTML, then replace the :)
string with an image of your trainers face.
Note: It's very important to escape text when displaying it again as HTML, in order to prevent cross-site scripting (XSS) attacks. Usually you use <c:out>
to automatically do this escaping for you.
Since you want some HTML in the text, you can't use <c:out>
, so you have to escape the rest of the text. See this page for ideas of how to do that: Best way to encode text data for XML in Java?
Then you replace the :)
with an image tag: <img src="trainer.png">
, and of course add that image file to your webapp.