Search code examples
stringgrailsstring-formattinggsp

formatting text output in grails


Hi in my grails project I am parsing a java property file, and passing the information to a string, which is an attribute for my domain class. It parses fine but when I print it in the view to see the data parsed, it has lost all its formatting. Mainly I want to keep the new line characters that were in the original file. I tried searching for a way to format the output but I could not find anything. Any help will be appreciated


Solution

  • It sounds like you need to keep the orginal formatting that is in the string and HTML is probably stripping the whitespace out. Try the following in your view:

    <pre>
    ${domain.attribure}
    </pre>