JSP text editor usage

Source: Internet
Author: User

Use of online text editor FCKeditor in JSP Project Development the following operations are performed on the Tomcat server (not in the development environment) first download two packages: fckeditor_2.6.4.zip, (FCKeditor main file) FCKeditor-2.3.zip, (JSP, FCKeditor integration package) Step 1: Decompress fckeditor_2.6.4.zip (main file of FCKeditor) and copy the FCKeditor directory to the root directory of the website. If a website named BBS is set up, copy the FCKeditor directory to the BBS directory (note that the BBS file directory under Tomcat is not the BBS directory in the development environment ). Step 2: Decompress fckeditor-2.3.zip, (JSP, FCKeditor integration package, on the official website it is part of the Java file that), will FCKeditor-2.3/web/WEB-INF/web. in XML, the servlet-mapping definition is copied to the web of your project. XML file (note that Tomcat/BBS/WEB-INF/web. XML Web. modify the web. in the XML file: Connector/Editor/filemanager/Browser/default/connectors/JSP/connector simpleuploader/Editor/filemanager/upload/simpleuploader: connector/FCKeditor/Editor/filemanager/Browser/default/connectors/JSP/connector simpleuploader/FCKeditor/Editor/filemanager/upload/simpleuploader copy files under the FCKeditor-2.3/web/WEB-INF/lib directory lib folder of your project (note the/BBS/WEB-INF/lib folder under Tomcat) step 3: Create a test in the root directory of the website (under BBS. JSP and test1.jsp files test. the content of the JSP file is:


The content of the test1.jsp file is:

In test. create a FCKeditor object in JSP, and associate editordefault with the request in its initialization method, and then use the request in test1.jsp. getparameter reads the value of the editordefault attribute. This value is the content of the text editor. It can be directly stored in the database and then translated in HTML, which is exactly the same as the value during editing. Note: The following are essential for using an online editor.

Simplified content (excerpted below): the toolbar is configured at the end. The toolbar configuration mainly changes fckconfig. js in the FCKeditor directory. You can search for 'fckconfig. JS 'or 'fck toolbar', find an article: fck editor streamlined toolbar fckconfig. the original toolbar settings in JS are: fckconfig. toolbarsets ["default"] = [['source', 'docprops', '-', 'save', 'newpage', 'preview ','-', 'templates'], ['cut ', 'copy', 'paste', 'pastetext ', 'pasteword','-', 'print', 'spellcheck'], ['undo ', 'redo', '-', 'Find ', 'replace', '-', 'selectall', 'removeformat'], ['form ', 'checkbox', 'Radio ', 'textfield', 'textta', 'select', 'click', 'imagebutton ', 'dendenfield'], '/', ['bold ', 'italic', 'underline', 'strikethangout', '-', 'subscript', 'superscript'], ['orderedlist', 'unorderedlist ', '-', 'outdent ', 'indent', 'blockquote'], ['justifyleft', 'justifycenter', 'justifyright', 'justifyfull'], ['link ', 'unlink', 'anchor'], ['image', 'flash', 'table', 'rule', 'smiley ', 'specialchar', 'pagebreak'], '/', ['style', 'fontformat', 'fontname', 'fontsize'], ['textcolor', 'bgcolor'], ['fitwindow ', 'showbuckets', '-', 'about'] // No comma for the last row.]; the article is simplified to: // set fckconfig in the default editor toolbar. toolbarsets ["default"] = [['source'], ['pastetext ', 'pasteword','-'], ['undo', 'redo ', '-', 'Find ', 'replace', '-', 'selectall', 'removeformat', '-', 'subscript', 'superscript'], ['orderedlist', 'unorderedlist', '-', 'outdent ', 'indent', 'blockquote ', 'showblok'],'/', ['bold ', 'italic ', 'underline', 'strikethangout'], ['justifyleft', 'justifycenter', 'justifyright', 'justifyfull'], ['link ', 'unlink'], ['textcolor', 'bgcolor'], ['image', 'flash', 'table', 'rule', 'smiley ', 'specialchar ', 'pagebreak'], '/', ['fontformat', 'fontname', 'fontsize'],]. Finally, I removed some features and simplified them to fckconfig. toolbarsets ["default"] = [['pastetext ', 'pasteword','-'], ['undo', 'redo ','-', 'Find ', 'replace ','-', 'selectall', 'removeformat','-', 'subscript', 'superscript'], ['orderedlist', 'unorderedlist ', '-', 'outdent ', 'indent'], ['link', 'unlink'], ['textcolor', 'bgcolor'], ['table ', 'rule', 'specialchar ', 'pagebreak'],'/', ['bold', 'italic ', 'underline', 'strikethangout'], ['justifyleft ', 'justifycenter', 'justifyright', 'justifyfull'], ['fontformat', 'fontname', 'fontsize'],]; note that the sequence can be changed randomly ,'/', represents a branch. The content in a [] is a centralized area.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.