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