Reputation: 115
I am just starting a very basic program in Grails (never used it before, but it seems to be very useful).
What I have so far is:
in X.groovy, a String named parameters, with constraint of maximum length 50000 and a couple other strings and dates, etc.
in XController.groovy, static scaffold = X;
It displays the scaffold UI (very handy!), and I can add parameter strings and the other objects associated with it.
My problem is that the parameters string is a long string with formatting that is pasted in by the user. When it is displayed on the browser, however, it does not retain any carriage returns.
What is the best way to go about this? I'm a very beginner at Grails and still have lots and lots of learning to do on this account. Thanks.
Upvotes: 0
Views: 320
Reputation: 3769
The problem is that the string is being displayed using HTML which doesn't parse \n into a new line by default. You need to wrap the text in <pre>
(see: http://www.w3schools.com/tags/tag_pre.asp) or replace the \n with <br/>
tags to display it correctly to the user.
Upvotes: 3