The solution for saving JSP files to the database in the lost format is: jsp Database
What is the storage of articles on the website? Oralce is used for CLOB storage. There are many methods for Java to operate CLOB on the Internet. However, it is found that the format displayed on the webpage after reading is completely different from the format entered at the time, and this paragraph no longer exists.
Because the textarea tag is used on the page rather than the powerful webpage text editor, you have to handle the format problem by yourself. Below is a professional function I found, use it to escape the text string sent from the front-end and store it in the database. This time, the text that is read again shows paragraphs.
Solution code reference:
/*** Format the document information to keep the document format. Used for saving. ** @ Param str * @ return */public String HTMLEncode (String str) {str = str. replace (">", ">"); 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 the solution to saving JSP files to the lost format of the database. I hope it will be helpful for you to learn and have good ideas.