title: Working with long strings (heredocs) in Java - the readable approach?
body: <p>I need to work with long strings containing line breaks in Java. Those are for HTML generation, but it is not the most important here.</p>
  
  <p>I'm aware Java is cripple in a way it doesn't have <strong>heredocs</strong>. But there are other mechanisms I could use:</p>
  
  <p>1) String <strong>concatenation</strong> (or StringBuilders), not very readable and copy-pasteable.</p>
  
  <p>2) Storing strings in <strong>.properties</strong> files, either not very readable, but with higher copypasteability.</p>
  
  <p>3) Storing each "heredoc" in seperate <strong>.txt</strong> file, quite readable and copypasteable, but resulting in a horde of txt files.</p>
  
  <p>4) Template engines, like <strong>Velocity</strong> or <strong>Freemarker</strong> - moves design out of Java, requires a lot of map operations, it would be quite good, but the Velocity syntax and loop/if abilities aren't as readable as for example those from Smarty</p>
  
  <p>Each have pros and contras, I'd like to choose 3 but the management prefers 1 because of pure ideological reasons. I'd like to have some standard for working with heredocs in Java, possibly library that makes things easier. I'd be gratefull for any suggestions (with good arguments) how to work with heredocs.</p>
  
  <p>Thanx</p>