title: Unable to load full data on JSON with jQuery
body: <p>I'm trying to use Json with struts 2 and jquery, I am able to do it up to a level but I have been stucking in some problem for last two days. Here are the codes and configuration that i've used for this </p>
  
  <pre><code>&lt;package name="default" extends="struts-default,json-default" namespace="/"&gt;    
  
      &lt;result-types&gt;
          &lt;result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult"&gt;&lt;/result-type&gt;
      &lt;/result-types&gt;
  
      &lt;action name="showUpdateAjax" class="courseCreateAction" method="showUpdateAjax"&gt;
              &lt;result type="json"&gt;
                  &lt;param name="includeProperties"&gt;courseInfo, fetchedAllSubjects, selectedFetchedSubs, subjectList, fetchedAllExamType, examTypeList, selectedExmTypes, fetchedAllCourse, isUpdate, btnPressed, updateCourseId, nextCourse, previousCourse&lt;/param&gt;
                  &lt;param name="prefix"&gt;true&lt;/param&gt;
                  &lt;param name="ignoreHierarchy"&gt;false&lt;/param&gt;
              &lt;/result&gt;
      &lt;/action&gt;
  </code></pre>
  
  <p>Here is my Jsp codes for this part</p>
  
  <pre><code>&lt;tr&gt;&lt;td&gt;&lt;input type="submit" value="Refresh" onclick="refreshData()" id="refreshBtn"/&gt;&lt;/td&gt;&lt;/tr&gt;
  
      &lt;tr&gt;&lt;td&gt;&lt;s:a href="/SASIS/showUpdateAjax.action?updateCourseId=4"&gt;click Here 2&lt;/s:a&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  &lt;/center&gt;
  &lt;script type="text/javascript"&gt; 
      $(document).ready(function(){
              $("#refreshBtn").click(function(){
                  $.getJSON("/SASIS/showUpdateAjax.action?updateCourseId=4",function(data){
                      alert('its working '+data);
  
                      });
  
                  });
          });
  &lt;/script&gt;
  </code></pre>
  
  <p>And here is my java code</p>
  
  <pre><code>public class CourseCreateAction extends ActionSupport implements ServletRequestAware{
  private CourseInfo courseInfo;
  private List fetchedAllSubjects;
  private List&lt;SubjectInfo&gt; selectedFetchedSubs;
  private List subjectList;
  private List fetchedAllExamType;
  private List examTypeList;
  private List&lt;ExamType&gt; selectedExmTypes;
  private List fetchedAllCourse;
  private String nextCourse;
  private String previousCourse;
  private DAOInterface dao;
  private String btnPressed;
  private String updateCourseId;  
  private HttpServletRequest request; 
  private boolean isUpdate;
  
  public void setServletRequest(HttpServletRequest request) {
      request=request;
  }
  
  public List getFetchedAllSubjects() {
      return fetchedAllSubjects;
  }
  
  public void setFetchedAllSubjects(List fetchedAllSubjects) {
      this.fetchedAllSubjects = fetchedAllSubjects;
  }
  
  public List&lt;SubjectInfo&gt; getSelectedFetchedSubs() {
      return selectedFetchedSubs;
  }
  
  public void setSelectedFetchedSubs(List&lt;SubjectInfo&gt; selectedFetchedSubs) {
      this.selectedFetchedSubs = selectedFetchedSubs;
  }
  
  public List getSubjectList() {
      return subjectList;
  }
  
  public void setSubjectList(List subjectList) {
      this.subjectList = subjectList;
  }
  
  public CourseInfo getCourseInfo() {
      return courseInfo;
  }
  
  public void setCourseInfo(CourseInfo courseInfo) {
      this.courseInfo = courseInfo;
  }
  public List getFetchedAllExamType() {
      return fetchedAllExamType;
  }
  
  public void setFetchedAllExamType(List fetchedAllExamType) {
      this.fetchedAllExamType = fetchedAllExamType;
  }
  
  public List getExamTypeList() {
      return examTypeList;
  }
  
  public void setExamTypeList(List examTypeList) {
      this.examTypeList = examTypeList;
  }
  
  public List&lt;ExamType&gt; getSelectedExmTypes() {
      return selectedExmTypes;
  }
  
  public void setSelectedExmTypes(List&lt;ExamType&gt; selectedExmTypes) {
      this.selectedExmTypes = selectedExmTypes;
  }
  
  public List getFetchedAllCourse() {
      return fetchedAllCourse;
  }
  
  public void setFetchedAllCourse(List fetchedAllCourse) {
      this.fetchedAllCourse = fetchedAllCourse;
  }
  
  public String getNextCourse() {
      return nextCourse;
  }
  
  public void setNextCourse(String nextCourse) {
      this.nextCourse = nextCourse;
  }
  
  public String getPreviousCourse() {
      return previousCourse;
  }
  
  public void setPreviousCourse(String previousCourse) {
      this.previousCourse = previousCourse;
  }
  
  public DAOInterface getDao() {
      return dao;
  }
  
  public void setDao(DAOInterface dao) {
      this.dao = dao;
  }
  
  public String getBtnPressed() {
      return btnPressed;
  }
  
  public void setBtnPressed(String btnPressed) {
      this.btnPressed = btnPressed;
  }
  
  public String getUpdateCourseId() {
      return updateCourseId;
  }
  
  public void setUpdateCourseId(String updateCourseId) {
      this.updateCourseId = updateCourseId;
  }
  
  public boolean getIsUpdate() {
      return isUpdate;
  }
  
  public void setIsUpdate(boolean isUpdate) {
      this.isUpdate = isUpdate;
  }
  
  public String showUpdateAjax(){
          try{
          System.out.println("Ajax calling...........");
          showUpdateCourse();
          }catch (Exception e) {
              e.printStackTrace();
          }
          return SUCCESS;
      }
  
  public String showUpdateCourse(){
      try {
          isUpdate=true;
          courseInfo=dao.getCourse(Integer.parseInt(updateCourseId));
          System.out.println(courseInfo.getCourseId());
          selectedFetchedSubs=courseInfo.getSubjectList();
          selectedExmTypes=courseInfo.getExamTypeList();
          fetchedAllSubjects=dao.getAllSubjects();
          fetchedAllExamType=dao.getActiveExamTypes();
          for(ExamType exmType:selectedExmTypes)
              for (int i = 0; i &lt; fetchedAllExamType.size(); i++) {
                  if(exmType!=null&amp;&amp;((ExamType)fetchedAllExamType.get(i)).getExamTypeId()==exmType.getExamTypeId()){
                      fetchedAllExamType.remove(i);
                      break;
                  }
              }
          for(SubjectInfo subInfo:selectedFetchedSubs)
              for (int i = 0; i &lt; fetchedAllSubjects.size(); i++) {
                  if(subInfo!=null&amp;&amp;((SubjectInfo)fetchedAllSubjects.get(i)).getSubjectId()==subInfo.getSubjectId()){
                      fetchedAllSubjects.remove(i);
                      break;
                  }
              }
      } catch (Exception e) {
          e.printStackTrace();
      }
      return SUCCESS;
  }
  </code></pre>
  
  <p>I have used spring and hibernate in project as well. While doing this when I click on the link which is calling the showUpdateAction.action I got response like this </p>
  
  <pre><code>{}&amp;&amp; {"btnPressed":null,"courseInfo":{},"examTypeList":null,"fetchedAllCourse":[],"fetchedAllExamType":[],"fetchedAllSubjects":[],"isUpdate":true,"nextCourse":null,"previousCourse":null,"selectedExmTypes":[],"selectedFetchedSubs":[],"subjectList":null,"updateCourseId":"4"}
  </code></pre>
  
  <p>But when I click on the button its not showing anything, but the function is called. Moreover here CourseInfo is an object where there are variables with setter getter methods and this object is state full when the showUpdateAction.action is called, but in the output we can see the courseInfo is with empty curly braces. Please help to solve this problem I have gone through several posts and googled a lot. Now I have no option except asking. Please help</p>