Referring to this answer, if you're using some jsp technology, look for the escape
or htmlEscape
kinda attributes. And set them to false
.
For me I was trying to validate a form with org.springframework.validation.Validator
, and was struggling to render a line break in the html code when an email is not valid.
if (!emailId.matches("^.+@.+\\..+$")) {
errors.rejectValue("emailId", "error.emailId", "Email ID cannot be blank<br>Should be proper email ID format");
}
After setting htmlEscape="false"
, it worked!
<td>
Email ID
</td>
<td>
<form:input type="email" path="emailId" id="emailId" />
</td>
<td>
<form:errors path="emailId" />
</td>
I know this answer may be inappropriate for the problem I tried to provide a solution. But, as I couldn't find a exact solution for the issue I was facing, I thought it'd be okay to send it here.
` tag? – Slava Semushin Mar 29 '13 at 08:08