getJson won't retrieve me anu result

getJson won't retrieve me anu result

Hi, im developing a jsp page using the struts technology. The problem is that i need to invoke a java class retrieving a JSON object from it, but at the moment it won't work

This is my jquery code

  1.  $.getJSON( "checkData", {idp:idp},function( data ) {
  2.              alert('json');
  3.           //some code     
  4.     
  5. });


struts.xml is correctly configured to call the checkData.java class using the space name "checkData" that i pass in getJSON method.
The class is correctly invoked, because i see all details in the debugin console (i'm using netbeans).

The problem is that no result is retrieved by the jquery, in fact alert("json") is never called!



this is checkData.java

  1. package com.mycompany;
  2. import UnitOfWork.UnitOfWork;
  3. import Javabean.Provincia;
  4. import Javabean.Comune;
  5. import com.opensymphony.xwork2.ActionSupport;
  6. import java.sql.SQLException;
  7. import java.util.ArrayList;
  8. import java.util.logging.Level;
  9. import java.util.logging.Logger;
  10. public class checkData extends ActionSupport{
  11.    
  12.     private ArrayList<Provincia> listaProvincie = new ArrayList<>();
  13.     private ArrayList<Comune> listaComuni = new ArrayList<>();
  14.    
  15.     private int idp;
  16.     public ArrayList<Provincia> getListaProvincie() {
  17.         return listaProvincie;
  18.     }
  19.     public void setListaProvincie(ArrayList<Provincia> listaProvincie) {
  20.         this.listaProvincie = listaProvincie;
  21.     }
  22.    
  23.     public int getIdp() {
  24.         return idp;
  25.     }
  26.     public void setIdp(int idp) {
  27.         this.idp = idp;
  28.     }
  29.     public ArrayList<Comune> getListaComuni() {
  30.         return listaComuni;
  31.     }
  32.     public void setListaComuni(ArrayList<Comune> listaComuni) {
  33.         this.listaComuni = listaComuni;
  34.     }
  35.   
  36.   
  37.  
  38.     @Override
  39.     public String execute(){
  40.        
  41.         UnitOfWork u = new UnitOfWork();
  42.       
  43.         if(idp >= 0){
  44.                listaComuni = u.GetDaoComune().getComuniByProvincia(idp);
  45.               
  46.              }
  47.       
  48.        return "SUCCESS";
  49.     }
  50.    
  51. }


this is the struts.xml

  1. <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">
     
    <struts>
     
        <package name="user" namespace="/User" extends="struts-default, json-default" >
      
                    <action name="checkData" class="com.mycompany.checkData">
                         <result type="json" />
                         <result name="input">registrazione.jsp</result>
                         <result name="SUCCESS">registrazione.jsp</result>
                         <result name="ERROR">registrazione.jsp</result>
                   </action>
            
        </package>
       
    </struts>