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

HTML Encoding in Java  RSS feed

 
Parul Saxena
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm dealing with VB script code that uses Server.HTMLEncode(str) method to perform HTML encoding.

Can anyone tell me what is the equivalent available in Java/JavaScript to perform HTML encoding of a string in a JSP?
I could find URLEncoder class which probably performs the URL encoding only not HTML.

Thanks,
Saxena
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at JSTL's cut action (section 4.2 in the JSTL Spec).
Specifically, look at its escapeXml attribute.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!