JSP-08-use of third-party controls, jsp-08-third-party controls

Source: Internet
Author: User

JSP-08-use of third-party controls, jsp-08-third-party controls
Add Image

1) Check the request type

Boolean isMultpart = ServletFileUpload. isMultipartContent (requeset );

If (isMultpart) // when enctype = "multipart/form-data" and method = "post", this value is true

2) declared object

DiskFileItemFactory factory = new DiskFileItemFactory ();

ServletFileUpload upload = new ServletFileUpload (factory );

3) Conversion request object

List <FileItem> items = null;

Items. parseRequest (request );

4) Save the uploaded file

If (item. isFormField ){

File. fullFile = new File (item. getName );

File uploadFile = new File (realPath, fullFile. getName );

Item. write (uploadFile );

}

5) obtain common fields

If (item. isFormField ){

Fieldname = item. getFieldName ();

If (fieldname. equals ("title ")){

News. setTitle (item. getString ("UTF-8 "));

}

}

 

WYSIWYG

Http://ckeditor.com/download

<Script type = "text/javascript" src = "<% = request. getContextPath () %>/ckeditor. js"> </script>

3. Use CKEditor to edit content

Add class = "ckeditor" to the "content" textarea tag"

4. Submit the content edited by CKEditor

Note: The field type in the database is "CLOB" (oracle)

 

--------------------

1. The meaning of the CKEditor folder

_ Samples: stores the official Demo

Lang: stores multi-language files

Skins: Skin folder

 

2. You can configure ckeditor through the CKEditor. js file,

CKEDITOR. editorConfig = function ()

{

Config. language = 'zh-cn'; // configuration language

Config. uiColor = '# AADC6E ';

Config. width = 'auto ';

Config. skin = 'office2003 '; // skin: v2, kama, office2003

};

 

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.