aspose file tools*
The moose likes Java in General and the fly likes Velocity new line Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Velocity new line" Watch "Velocity new line" New topic
Author

Velocity new line

Konstantin Chikarev
Greenhorn

Joined: Feb 19, 2005
Posts: 26
Hi all! I didn't find how to set new line in velocity variable. Construction like #set ($test = "line1\n line2") doesn't do that.

Thanks


http://antilogics.com/
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
I've done lots with Velocity, but surprisingly never had to do this.

Have you tried doubling the backslash?


Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Marco Ehrentreich
best scout
Bartender

Joined: Mar 07, 2007
Posts: 1282

Hi,

are you possibly using Velocity templates for HTML pages? Then of course a newline in the source code wouldn't be the same as a newline in your HTML page (<br> . That's just a thought because I personally have no experience with Velocity...

Marco
Konstantin Chikarev
Greenhorn

Joined: Feb 19, 2005
Posts: 26
I don't use velocity for HTML.
I've tried It renders as . renders as
I am constructing template from peaces and than giving it to velocity. May be that's the cause.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Velocity new line