Getting started with the FCKeditor Control on the JSP page

Source: Internet
Author: User

FCKeditor controls please go to the official website to download some of the content in the http://www.fckeditor.net idea, readers can download.

1. Open the compressed package fckeditor_2.6.3.zip, copy the FCKeditor folder to the WEB-INF, which can be directly used later.

2. There are two ways to use FCKeditor on the page.
Method 1: Javascript
(1) for direct use, seeMethod1.html

  1. <! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en">
  2. <HTML>
  3. <Head>
  4. <SCRIPT type = "text/JavaScript" src = "FCKeditor/FCKeditor. js"> </SCRIPT>
  5. </Head>
  6. <Body>
  7. Method 1: Implement editor import through javascript <br>
  8. <SCRIPT type = "text/JavaScript">
  9. VaR ofckeditor = new FCKeditor ('fckeditor1 ');
  10. Ofckeditor. basepath = "FCKeditor /";
  11. // Ofckeditor. basepath = "/fckedittest/FCKeditor /";
  12. Ofckeditor. width = "50% ";
  13. Ofckeditor. Height = "400 ";
  14. Ofckeditor. value = "Initial Value ";
  15. // Ofckeditor. toolbarset = "Basic ";
  16. // The default value is default.
  17. Ofckeditor. toolbarset = "default ";
  18. Ofckeditor. Create ();
  19. </SCRIPT>
  20. <HR>
  21. </Body>
  22. </Html>

(2) PassTextarea, see method2.html

  1. <! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en">
  2. <HTML>
  3. <Head>
  4. <SCRIPT type = "text/JavaScript" src = "FCKeditor/FCKeditor. js"> </SCRIPT>
  5. <SCRIPT type = "text/JavaScript">
  6. Window. onload = function (){
  7. VaR ofckeditor = new FCKeditor ('Mytextarea');
  8. Ofckeditor. basepath = "FCKeditor /";
  9. // Ofckeditor. basepath = "/fckedittest/FCKeditor /";
  10. Ofckeditor. replacetextarea ();
  11. }
  12. </SCRIPT>
  13. </Head>
  14. <Body>
  15. Method 2: Implement editor import through textarea <br>
  16. <Textarea rows = "4" Cols = "60" name ="Mytextarea"> This is a value </textarea>
  17. </Body>
  18. </Html>

Method 2: Use FCKeditor on tags
Before using tags, you need to build an environment. Copy the slf4j-simple-1.5.2.jar in idea to the lib directory and build the environment.
After the construction, you can use it on the JSP page. See method_jsp.jsp.

  1. <% @ Page Language = "Java" Import = "Java. util. *" pageencoding = "UTF-8" %>
  2. <% @ Taglib uri = "http://java.fckeditor.net" prefix = "fck" %>
  3. <! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en">
  4. <HTML>
  5. <Head>
  6. <Title> method_jsp.jsp </title>
  7. </Head>
  8. <Body>
  9. In earlier versions, the value attribute of FCKeditor must be specified and the value cannot be blank.
  10. The version 2.6.3 has been resolved.
  11. <Fck: Editor InstanceName = "myeditor" basepath = "/FCKeditor"> </fck: Editor>
  12. </Body>
  13. </Html>

The effect is as follows:

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.