After much efforts, I finally have a simple Java server that connects to a browser through HTTPS. User submits a form to the server via browser. The server receives it, process it, and then I need to send back the result text as HTML code. The problem is that my results are formatted in JAVA; new lines are formatted by \n
and tabs by \t
as opposed to <br>
and such, which is not recognized by the browser, and the text is messed up. How can I format the text to be HTML friendly?
Asked
Active
Viewed 27 times
0

Tina J
- 4,983
- 13
- 59
- 125
1 Answers
0
You'll need to use regular expressions to find and replace the newline characters with <br>
. Here's a similar question: replace \n and \r\n with <br /> in java

Community
- 1
- 1

Dave Morrissey
- 4,371
- 1
- 23
- 31