In a JSP file I wanto to replace newlines (\n) with <br />. I tried
${fn:replace(someString, '\n', '<br />')}
But I get an error '\n' ecnountered, was expeting one of...
Which I guess it means the parser doesn’t like something like this.
Is it possible to do something like this using EL?
Create an EL function for that.
First create a static method which does the desired job:
Then create a
/WEB-INF/functions.tldwhich look like follows:Finally use it as follows:
See also: