How does Experts Exchange format their text?
Posted on 2004-11-01
Meaning that, right now I am entering text into a textbox (textarea) and I put in some simple formatting in here ... nothing rich text though.
Just some line breaks ....
- And some spaces for maybe code or example text
All I want to do is get the same simple HTML formatting into my pages ... I am using JSP to do the dynamic input and output for my pages and so far I am saving the results to the database without any problem. I am just looking for the best way to format it on the way back out ... or is it best to save the initial input as the formatted HTML that I want so I don't need to perform an action on the text every time I pull it out from the DB?
So far I am thinking of just doing a simple replace of a carriage return (character 32?) with a "<br>" and I think that I will look for instaces of 2 spaces in a row and replace that with a " " ... regular expression ... I think.
What are your thoughts? Code snippets in Java?