.Maui Blog

Replacing Newline Characters in Java and JSTL

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %> 
<% pageContext.setAttribute("newLineChar", "\n"); %>

<p class="text-muted">
    ${fn:replace(myText, newLineChar, "<br />")}
</p>
Exit mobile version