Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem while saving HTML tag as Data in database  RSS feed

 
vikasids sharma
Ranch Hand
Posts: 157
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all
i m entering some HTML tag in database(<table>,<br> etc)through a user interface designed using html and JSP.
Browser takes it as HTML tag instead of databse data while recovering or displaying it on screen.
Please let me know how to differentiate this data from HTML tag while diplaying it on screen.
thanks
Vikas
 
Rob Ross
Bartender
Posts: 2205
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll have to escape the characters that delimit html markup. For example, you could store them as braces ([ ]) instead of < and > in your database, or try preceding them with the backslash: \> and \<
[ September 10, 2003: Message edited by: Rob Ross ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66205
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or HTML encode the data either prior to storing it, or just prior to display, whichever makes more sense. By HTML encoding, I mean to reaplce characters like < and > with &lt; and &gt;, and so on.
hth,
bear
[ September 10, 2003: Message edited by: Bear Bibeault ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!