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

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -