Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to display a text with tags in jsp

I want to display a text called

"welcome<to>Jsp"

In page source also i'm seeing as "welcomeJsp"

But in HTML its displaying as "welcomeJsp" alone. Please guide me.

like image 919
user1738638 Avatar asked Oct 06 '22 01:10

user1738638


1 Answers

You have to escape these characters..

welcome&lt;to&gt;Jsp

I would advice using Apache's StringEscapeUtils class(available in org.apache.commons.lang ) function escapeHtml() for escaping HTML.

StringEscapeUtils.escapeHtml("welcome<to>Jsp")

like image 195
Shashank Kadne Avatar answered Oct 13 '22 12:10

Shashank Kadne