PDA

View Full Version : How to make Servlet call from ExtJs?



swiji2000
25 Apr 2012, 9:57 PM
Hi,

I am a beginner for ExtJs. I want to do one search page.
Step1: Created Ext Js view and call servlet url.
Step2: Created a servlet and it connected with db.
Step3: Started Tomcat server.
Issue: When I click “search” button it will return, “Object doesn't support this property or method”.
Code :
xtype: 'button',
width: 50,
text: 'Search',
x: 720,
y: 60,
renderTo: Ext.getBody(),
handler : function(){
Ext.Ajax.Request({ // error in this line
url:"client/ClientSearchList",
method: 'POST',
params: {
ssn:Ext.getCmp('ssn').getRawValue()
},
success: function (result, request){
alert('Search completed Succesfully..' + result.responseText);
},
failure: function (result, request){
alert('Error in server' + result.responseText);
}
});
}

Please let me know the issue and guide me.

Thanks in Advance

börn
25 Apr 2012, 10:56 PM
1st: learn to use debugging tools like firebug in firefox or the chrome developer tools in chrome (hit f12 on win).

2nd: the function you are trying to access to is: request: Ext.Ajax.request.

In the console of your debugging tool, you can access all Extjs Objects loaded - e.g. in your case: Ext.Ajax and look for the functions it offers - you can also try the functions behaviour directly in the console, which is in the case of javascript and the learning process a good way to start...