Enctype= "Multipart/form-data" is not a value

Source: Internet
Author: User

Today found in the company's SSH framework, the service successfully executed, immediately invoke another action, in the form of the value did not pass, it is very strange. Theoretically, the two action uses the same form, the DTO, and the value transfer is fine. After other people's search, originally in the JSP Form has joined Enctype= "Multipart/form-data" and resulting in the value.

Here a little bit deeper, the encoding method Enctype is to set the page to submit the encoding method, mainly includes 3 kinds.

Coding method Specific Meaning

Text/plain is sent as plain text

Application/x-www-form-urlencode using the default encoding form

Multipart/form-data use mine encoding to send

If you have files in your form that you want to upload, you must use the Multipart/form-data method. However, the value taken out with Request.getparameter ("XXX") will be null. Enctype= "Multipart/form-data" is the uploading of binary data; The value of input in the form is passed in 2-way.
The input value in the form is passed in 2, so the request is not worth it. In other words, the code is added and the request will not be successful.
When you add a form value to a database, you can use the following methods:
Smartupload su = new smartupload ()//New Smartupload Object
Su.getrequest (). Getparametervalues (); take the array value
Su.getrequest (). GetParameter (); Take a single parameter single value

You can also use the following methods:

O ' Reilly component  multipartrequest object. GetParameter (""); to obtain.

Other methods can refer to the following article: http://enjoy123.5d6d.com/archiver/tid-403.html

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.