In my legacy project i can see the usage of escapeHtml before string is sent to browser.
StringEscapeUtils.escapeHtml(stringBody);
I know from api doc what escapeHtml does.here is the example given:-
For example:
"bread" & "butter"
becomes:
"bread" & "butter".
My understanding is when we send the string after escaping html its the browser responsibility that converts back to original characters. Is that right?
But i am not getting why and when it is required and what happens if we send the string body without escaping html? what is the cost if we dont do escapeHtml before sending it to browser