javascriptajaxextjssencha-touch-2.3

How to handle AJAX requests in EXTJS


I have a code to send an AJAX request which seems to work fine under firebug (sending correct parameters) :

Ext.Ajax.request({
            url: 'test',
            params:{name: "bunya"},
            success: function(resp){ 
                    button1.setText(resp.responseText);
                },
            failure: function(e,resp){
                    button1.setText('Disgrace!');
                }
            });
    }

Servlet code part (from what i understand) should get name:

String respString =request.getAttribute("name").toString();

which returns null.

My question is, how can i get the attributes from this application/x-www-form-urlencoded request?


Solution

  • You should use request.getParameter("name") for fetching a parameter value. You can use request.getParameterNames() to fetch all parameter names in the current request.