I’ve been working with Apache’s Velocity engine and a custom template.
The thing is, that I haven’t been able to generate a String with the corresponding line breaks.
I tried almost everything that I found, such as using $esc.n and $esc.newline (I’m already using escape tools on my project) but it seems that the version I’m currently using doesn’t support it (1.4), checked if putting ‘\n’, ‘\\n’ and even ‘\\\n’ would work, but same thing.
Does anyone have any solution to this?
We had issues with newlines and ended up putting a property on the VelocityContext:
Then, wherever we needed to use a newline, we would reference the context variable:
We use this in cases where we need to replace newlines in a string with <br />.