This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.
Test areas will already keep the original formatting. Where formatting is "lost" it's simply because of how HTML works: extra whitespace is ignored. If you want the original formatting to be maintained when the HTML is rendered you need to convert spaces to HTML entities, CRLFs to <br/> tags, and so on.