(For just multi-line strings in Java, see: Java multiline string. This question below may bleed out into different answers considering the web app and HTML output context.)
Is there a way to enter multiple lines of text (stored a String
) as Java code without formatting it?
I'd like to avoid:
"..." +
format on each line (necessary to wrap a text in Java)- escaping quotation marks contained within the text.
- avoid
\n
for breaks on each line
It's a MVC webapp and it's HTML code I am outputting, fitted with some variables here and there. The string in question is so long as it's an entire row of a table, where each row contains values such as id, key, value, etc. The .jsp
file just has a single variable that contains the eventually output of all these rows, generated by a Java method. I've done the same with drop down boxes in forms, generating maybe options, <option>...</option>
, but that code was small and tight when generated with Java. These rows I am stuck on are are large and complicated by comparison. I want the output HTML to be readable.
Likely not, but had to ask. Never know what you might miss.