« Return to Thread: Likely a common question - carriage return / new line in string literals in Velocity Script

Re: Likely a common question - carriage return / new line in string literals in Velocity Script

by Nathan Bubna :: Rate this Message:

Reply to Author | View in Thread

if you are using Velocity 1.5, you can just put the new line in there:

#set( $foo = "this has a
line break" )

if you're using an earlier version, the easiest way is to just add one
to the context:

context.put("n","\n");

then in your template:

#set( $foo = "this has a${n}line break" )

On Wed, Apr 16, 2008 at 3:08 PM,  <scott.grunewald@...> wrote:

> I have a feeling this question has been answered many times, but I could not find a FAQ for the user mailing list, so here goes...
>
>  Is there any provision for including a new line / carriage return in a string literal in Velocity Script? This is important for formatting blocks of text within a proprietary application.
>
>  Thank you,
>
>  Scott Grunewald
>  scott.grunewald@...
>  AIM: ScottGrunewald
>  Office #: 905-804-6942
>
>
>  This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information.  If you have received it in error, please notify the sender immediately and delete the original.  Any other use of the email by you is prohibited.
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: user-unsubscribe@...
>  For additional commands, e-mail: user-help@...
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@...
For additional commands, e-mail: user-help@...

 « Return to Thread: Likely a common question - carriage return / new line in string literals in Velocity Script