Is there a recommended way to escape <, >, \" and & characters when outputting HTML in plain Java code? (Other
<
>
\"
&
For some purposes, HtmlUtils:
import org.springframework.web.util.HtmlUtils; [...] HtmlUtils.htmlEscapeDecimal("&"); //gives & HtmlUtils.htmlEscape("&"); //gives &