R
R
Renat Iliev2014-12-10 17:12:03
Java
Renat Iliev, 2014-12-10 17:12:03

How to escape HTML tags using Java?

The data comes from the client to the Java server, then it is transmitted to other clients (output by HTML formatting) and you need to escape all HTML tags in the message, i.e. make sure that all clients perceive the string in the same way as it is written below and in the same way brought out:
<b>блаблабла<b/>
How to do it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
bromzh, 2014-12-10
@IzeBerg

stackoverflow.com/questions/4874626/java-escape-html
stackoverflow.com/questions/1265282/recommended-me...
Choose any
UPD
If you use jsp, then you can escape like this:
or like this:

<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
${fn:escapeXml(myString)}

This JSTL is used, but it's worth including it if you work with JSP.

N
Nikolai Pavlov, 2014-12-10
@gurinderu

docs.guava-libraries.googlecode.com/git/javadoc/co...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question