View Full Version : form parameters are missing

22 Nov 2007, 6:22 AM
Hi, all,

Happy Thanksgiving day!
I have a question about a form request, I use params: {uuid: id_params}, which I map "uuid" to id_params, the code I have is:

url : url,
params : {uuid: id_params},
method : 'POST',
form : form.el.dom,
isUpload : true,
callback : onAjaxResponse,
success : onAjaxSuccess,
failure : onAjaxFailure,
scope : this

When I print out the request object I got from my servlet code, the request object does not have the parameter I put in, if I call the HttpServletRequest, request.getParameter("uuid"), it returns null, anybody knows the reason?

[updateUploadInfo] - request==[uri: /upload
method: POST
QueryString: null
Name: host Value: localhost:8084
Name: user-agent Value: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20071025 Firefox/
Name: accept Value: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
Name: accept-language Value: en-us,en;q=0.5
Name: accept-encoding Value: gzip,deflate
Name: accept-charset Value: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Name: keep-alive Value: 300
Name: connection Value: keep-alive
Name: referer Value: http://localhost:8084/ext2fileupload/
Name: cookie Value: JSESSIONID=48D69DDF917192B4BE17AA3DD53280CF
Name: content-type Value: multipart/form-data; boundary=---------------------------278811606516223
Name: content-length Value: 2387216

Thanks very much for your help on Thanksgiving day.


22 Nov 2007, 7:35 AM
You must encode params before sending with:

This works just fine for me

22 Nov 2007, 8:11 AM
That really depends on the value of id_params. What is it?

22 Nov 2007, 9:43 AM
I tried the urlEncode(), it did not work, the parameter I have is a string generated from a uuid generator, it is something like: "1D4169CB-A648-0001-7CA9-171A18001EF5". any idea how to pass it from the Ext.Ajax.request() call? I just need this string in the request so I can retrieve it from the HttpServletRequest object in my servlet code.


22 Nov 2007, 9:56 AM
Did you check if "id_params" has a value before you submit?

22 Nov 2007, 9:58 AM
Yes, I checked it had value like the string "1D4169CB-A648-0001-7CA9-171A18001EF5".



22 Nov 2007, 10:00 AM
RE: request.getParameter("uuid")

A POST will not send params embedded in the URL, they are sent as the POST body.

22 Nov 2007, 12:42 PM
Is there a way to put the param string into the request header like query string so I donot need to parse the POST body to get the value?



22 Nov 2007, 7:12 PM
If the server POST process requires a POST body, your only chance is to include it in the URL params.

Otherwise a GET would do what you want.

23 Nov 2007, 11:22 AM
Thanks very much for your help, finally I got it working by putting query string at the end of the url, and in my servlet I just call getParameter() on request, and I can retrieve it, what I donot understand is why the query string is treated like a parameter, as a matter as fact, I can also call getQueryString to get it as well, not sure why it is in both places, if I put the string in the params:{uuid:id_param}, It is in the POST body instead of the header.

Thanks again for your dicussion with me about this matter.


23 Nov 2007, 12:39 PM
Just to clarify it a bit better:

For a GET request, servers expects any parameters defined for the request to be included in the URL (after the ?), but there is a size limit to the URL length.

For a POST, client browsers place (and HTTP servers expect) such parameters (like form input values, file upload streams) in the body, where the size of such a payload is unlimited.

if I put the string in the params:{uuid:id_param}, It is in the POST body instead of the header.Yes, Ext.Ajax.request follows the HTTP specification: parameters you specify are placed the Request Body for a POST. For a GET, they are appended to the URL.

20 Apr 2009, 11:51 PM
I am having the same problem.

// create form for upload

var form = this.createForm(record);

// append input to the form

var inp = record.get('input');

// get params for request
url : this.url,
params : {
'folderId': record.get('folderId')
method : 'POST',
form : form,
isUpload : true,
scope : this,
record: record

I got the values at server side when I pass it as querystring but I dont want to do that,
I am passsing array , and I am getting comma seperated values at server side , So I just want to Post the values.

Did you find the solution to post values when uploading file through ajax request?

Thanks in adv.................