string - How can I replace newline characters using JSP and JSTL? -
i have list of bean objects passed jsp page, , 1 of them comment field. field may contain newlines, , want replace them semicolons using jstl, field can displayed in text input. have found 1 solution, it's not elegant. i'll post below possibility.
here solution found. doesn't seem elegant, though:
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> <% pagecontext.setattribute("newlinechar", "\n"); %> ${fn:replace(item.comments, newlinechar, "; ")}
Comments
Post a Comment