Display the string with new line with out using \n in jsp

I have a form with a text area as one of the input fields. I want to store the user entered data. In the process I need to store the \n (enter key). But here the problem is in the DataBase (MySql) data is stored, but \n is not stored; i.e. data store as:

enter image description here.

When I display the same data in the browser it shows in single line.

enter image description here

I need to split the data with \n and it should look like:

enter image description here

Jon Skeet
people
quotationmark

When I display the same data in the browser it shows in single line.

Yes, it would - because a newline in HTML doesn't get rendered as a newline. If you look at the raw HTML, I suspect you'll still see the line breaks... it's just that's not how it's rendered.

In order to represent line breaks in HTML, you need to use <br /> between lines, or something similar - or display it with a <pre> tag.

Basically, you need to format your raw text as HTML, however you decide to do that. If you're just dumping the HTML straight into your page, you may well find you already have issues if the text contains HTML tags - they should be escaped.

people

See more on this question at Stackoverflow