Displaying html vaadin

I have a text area where I allow user to type in a message. When I click on the send button I want the message to be converted to html rather than plain text. how could this be done?

Also if the message is in two lines I want the user to see the message in 2 lines rather than in one. but it seems the message contents are shown in one line. How could I show it in 2 lines?

The only way to show HTML is using a Label in HTML content mode. So, take the value from the textarea, parse and fix the string (e.g. newline to a br tag), and replace the textarea with a label component. You can also use a RichTextArea as the editor, which will return properly formatted HTML directly.

… and the usual word of warning: if you display user-entered test as HTML, beware of cross-site scripting attacks. This is a complex topic and in no way specific to Vaadin, but there should be plenty of material online.