Quick fix in java:
value = StringEscapeUtils.escapeHtml(value);
For a more in-deep solution i recommend checking: https://github.com/mehditahmasebi/spring/tree/master/spring-xss-filter