You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Randeep Walia <fa...@gmail.com> on 2007/12/01 00:02:52 UTC

Parameter Map is null after Ajax Request

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/%3C43D390A3.7010902@amazon.com.br%3E

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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Parameter Map is null after Ajax Request

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Randeep Walia [mailto:fatpunjabi@gmail.com] 
> Subject: Parameter Map is null after Ajax Request
> 
> Saving Set 3 will demonstrate a problem whereby the servlet 
> that processes this request has an empty Parameter map

Servlets don't have parameter maps, requests do.  Are you by any chance
storing the reference to a request's parameter map in an instance or
class variable of a servlet and thereby introducing threading problems?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

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