• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to avoid HTML elements from being interpreted for some text.

 
NareshKumar Yadav
Greenhorn
Posts: 6
Eclipse IDE Oracle Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am new to JSP and Servlets. However, with my preliminary study i have developed a simple application that reads an input from the user and displays the text on the page. i.e. user inputs some text in a textarea and the same is stored in Database and is shown back to the user. This works fine if the user inputs a simple string i.e. without any HTML element. (for example: Hello, this i my comment.) However if the user enters something like "<b>Hello</b>, this is my comment." This gets stored as it is in the database but while showing it back on page it shows Hello in bold letters. How do i avoid this ?

I am sorry if i have asked this under a wrong category. Please move it to correct category.

with Best Regards,
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65516
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you use the EL to display the value, the HTML will automatically be escaped.

So can we assume that for some reason yu are not using the EL?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!