Parameter Map is null after Ajax Request

2007-11-30 Thread Randeep Walia
Over a year ago, a user reported a problem with his Request parameter
map showing up null sporadically on his application:
http://mail-archives.apache.org/mod_mbox/tomcat-dev/200601.mbox/[EMAIL 
PROTECTED]

I am suddenly seeing similar behavior with our AJAX-enabled web application.

We are using RedHat Linux with Tomcat 5.5 and JDK 1.5.

Our application loads sets of text area dynamically using AJAX
(controlled by the Prototype library). The user can choose to open one
or more sets of text data, edit them, and submit the changes using
AJAX. It normally works well, but I am seeing a problem with certain
sets.

Say I have several sets of text data. I load the third set
successfully and edit it. Saving Set 3 will demonstrate a problem
whereby the servlet that processes this request has an empty Parameter
map, despite their being a considerable amount of data being
transmitted. A different set, say set 2, submits this data just fine.

My first theory as to why this was happening was that some invalid
character or too much data was causing the parsing to fail, but I
found that loading both sets 2 and 3 together and then saving (which
saves both sets) rather bizarrely caused the problem to vanish. What
are the circumstances under which the Parameter map could come up null
like this?

I'm not sure what code to post since this is pretty standard stuff,
but here is the Submit function which uses Prototype:

function ajaxSend(inForm)
{
   //If there is no input get the first form on the document
   var ajxForm = (inForm)?inForm:getAjxForm();

   setAjaxStatus('Submitting');

   var submitter = new Ajax.Request(
   'EditPaper',
   {
   method: 'post',
   parameters: Form.serialize(ajxForm),
   onComplete: ajaxReportStatus,
   onFailure: ajaxReportError
   }
   );

   return false; //Stops the form from submitting
}

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Parameter Map is null after Ajax Request

2007-12-01 Thread Randeep Walia
Thanks for the reply, guys.

I am aware that the Servlet does not have the parameter map directly
and that they must be accessed through the request object. I don't
know if I said something to that effect to make you think otherwise,
but yes, my program accesses the HTML form data via
request.getParameter()

And I don't believe this problem has much to do with the way or order
in which things are being processed. To that end I think you were
looking to see if it was an error in JavaScript logic and I don't
think that is the case. One thing I forgot to mention is that I tested
the same web application on my local (Windows) machine and it works
there without problems using the exact same data input.

As I stated earlier, I was using Prototype 1.4 to submit my AJAX
request. I upgraded to 1.6, the current version, and found that this
fixed the problem. Why? I have no idea. I thought the culprit might be
the Form.serialize() method which I am using to pass the form data to
the input into servlet but they seem to match perfectly. I will keep
investigating and let you know if I find anything conclusive.

Randeep

-
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]