I have solved this problem by writing the following custom tag:
public class NotePrint extends SimpleTagSupport {
private String note;
public void setNote(String note) {
this.note = note;
}
public String getNote() {
return note;
}
public void doTag() throws JspException, IOException {
PageContext pageContext = (PageContext) getJspContext();
JspWriter out = pageContext.getOut();
note.replace("\n\n", "\n ");
String[] noteArray = note.split("\n");
for (int i = 0; i < noteArray.length; i++) {
if (i == noteArray.length - 1) {
out.println(noteArray[i]);
} else {
out.println(noteArray[i] + "<br />");
}
}
}
}