Teknoloji ve Yazılım Blogu

  • Yazıtipi boyutunu arttır
  • Varsayılan yazıtipi boyutu
  • Yazıtipi boyutunu azaltır


Ext js ajaxI will talk about how to send ajax request to the url and how you can get data in server side (java code) in this tutuorial. We send Ajax request with function which named Ext.Ajax.request. This function takes following arguments.

url: This data gives information about which url will take this request. In our example will take this request.

params: This data includes variables which we will send to the server side code. In our example we assign isimsoyisim to content of textBox which id is "isimsoyisim" . If request will responsed properly success part will work if some error occurs failure part will work.


url : 'yenikullaniciekle',

     params : {



     success : function(response) {

obj = Ext.util.JSON.decode(response.responseText);



     failure : function(response) {

     Ext.MessageBox.alert("Bir hata oluştu!");



The following code is server side JAVA code. Which will take this http request for


public void yenikullaniciekle(HttpServletRequest req, HttpServletResponse resp) throws IOException{

KanBagiscisi bagisci=new KanBagiscisi();


JSONObject obj = new JSONObject();

obj.put("success", true);



We can get variables which sent from Ext JS scripts with java code using req.getParameter("isimsoyisim").

We have to send our response in JSON format to Ext JS scripts. We create new JSONObject instance and using put(key, value) method of this instance to put some data in this JSONObject. We assign true value to "success" variable in our example.

We can access this variable using obj = Ext.util.JSON.decode(response.responseText); and we will access success variable with obj.success.

We will add obj to rsponse with the following code resp.getWriter().print(obj);


Yorum ekle

Güvenlik kodu