What does the article on the website store? Using Oralce with CLOB storage, Java operation Clob method of a lot of online, but found that read after the display on the Web page and input when the format is completely different, the paragraph has ceased to exist.
Because the page uses a TEXTAREA tag instead of a powerful Web page text editor, so to deal with the format of their own problems, the following is a professional function I found, use it to pass the front of the article string escaped to save the database, this time again read the article will have a paragraph of the display.
Workaround code reference for JSP saved to database in lost format:
/**
* Format the article information, keep the article format. used when saving.
*
@param str
* @return
/Public
string HTMLEncode (String str) {
str = str.replace (">", "& gt; ");
str = str.replace ("<", "<");
char ch;
ch = (char) 32; Space
str = str.replace (string.valueof (CH), "");
ch = (char) 34; "
str = str.replace (string.valueof (CH)," "");
ch = (char) 39; '
str = str.replace (string.valueof (CH), "'");
ch = (char) 13; Carriage return
str = str.replace (string.valueof (CH), "");
ch = (char) 10; New line
str = str.replace (string.valueof (CH), "<BR>");
return str;
}
The above is and you share the JSP saved to the database lost format solution, I hope to learn some help, there are good ideas to welcome everyone to communicate and explore.