I have a list of bean objects passed into my JSP page, and one of them is a comment field. This field may contain newlines, and I want to replace them with semicolons using
This solution is more elegant than your own solution which is setting the pagecontext attribute directly. You should use the tag for this:
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
${fn:replace(data, newLine, "; ")}
BTW: ${fn:replace(data, "\n", ";")} does NOT work.