Win a copy of The Journey To Enterprise Agility this week in the Agile and Other Processes forum! And see the welcome thread for 20% off.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Velocity new line  RSS feed

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've done lots with Velocity, but surprisingly never had to do this.

Have you tried doubling the backslash?
 
best scout
Bartender
Posts: 1294
IntelliJ IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!