title: jQuery mobile + spring controller dynamic listview
body: <p>i'm using jquery listview to display list of course name. the data needs to take from the controller. when i run it, nothing display in the page.</p>
  
  <p>this is my html</p>
  
  <pre><code>   &lt;div id="courseName"&gt;
      &lt;ul data-role="listview" data-inset="true" &gt;
      &lt;/ul&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>and this is my script</p>
  
  <pre><code>$('#registeredClasses').live('pageshow', function(){
      $.ajax({
       url: '${pageContext.request.contextPath}/getRegisteredClassesData.html',
       dataType: 'json',
  
          success: function(json_results){
          listItems = $('#courseName').find('ul');
          $.each(json_results.rows, function(key) {
             html = '&lt;li &lt;h3&gt;&lt;a href="index1.html?id=' + [json_results.rows[key].courseId] +'"rel="external"&gt;'+json_results.rows[key].courseName+'&lt;/h3&gt;';
            html += '&lt;p&gt;&lt;br&gt; Course name: '+json_results.rows[key].courseName+'&lt;/p&gt;&lt;/a&gt;&lt;/li&gt;';
  
  
          listItems.append(html);
          });
            $('#courseName ul').listview('refresh');
   $.mobile.pageLoading(true);     
      }
  });
  });
  </code></pre>
  
  <p>and this is where it call from controller</p>
  
  <pre><code>@RequestMapping(value = "getRegisteredClassesData.html", method = RequestMethod.POST)
  public @ResponseBody CustomPagedResultResponse getRegisteredClassesData(
          HttpServletRequest request,HttpSession session) {
      CustomPagedResultResponse paging = new CustomPagedResultResponse();
  
      log.debug("getRegisteredClassesData.html:");  
      log.debug("rows:"+request.getParameter("rows"));
      log.debug("courseId:"+session.getAttribute("courseId")); 
      log.debug("page:"+request.getParameter("page"));
      log.debug("sidx:"+request.getParameter("sidx"));
      log.debug("sord:"+request.getParameter("sord"));
      //String loginId = (request.getSession().getAttribute("loginId")).toString();
      //String page =(request.getSession().getAttribute("page")).toString(); 
      //String row = (request.getSession().getAttribute("row")).toString();
  
      String page = request.getParameter("page");
      int pageSize = new Integer(request.getParameter("rows")).intValue();
      StringBuffer condition = new StringBuffer();
      if (request.getParameter("sidx") != null &amp;&amp; !request.getParameter("sidx").equals("")) {
          condition.append(request.getParameter("sidx"));
          condition.append(" ");
      }
      if (request.getParameter("sord") != null &amp;&amp; !request.getParameter("sord").equals("")) {
          condition.append(request.getParameter("sord"));
      }
      log.debug("condition: " + condition.toString());
      log.debug("page:"+page);
      log.debug("row:"+pageSize);
  
      String courseType = "%";
  
      UserProfile userProfile = (UserProfile)session.getAttribute("userProfile");
  
  
      //////////////////////////////////////////////////////
      // Retrieve  Total Record first
      ///////////////////////////////////////////////////////
      RegisteredClassesSearch search = new RegisteredClassesSearch();
      search.setLanguage("ENU");
      search.setLoginRowId(userProfile.getContactRowId());
      search.setRegNo(null);
      search.setAction("1");
      search.setCourseType(courseType);
      search.setPage(null);
      search.setPageSize(null);
      search.setOrderBy(null);
  
      Integer recordCount = registeredClassesService.getTotalAccounts(search);
      log.debug("*****Training Controller Total record:"+recordCount);
      System.out.println("*****Training Controller Total record:"+recordCount);
  
      //////////////////////////////////////////////////////
      // Retrieve  Total Record first
      ///////////////////////////////////////////////////////
      if(recordCount&gt;0){
  
          System.out.println("******** Login Id:"+userProfile.getContactRowId());
          System.out.println("******** Course Type:"+courseType);
          System.out.println("******** Page Size:"+pageSize);
          System.out.println("******** Page:"+page);
          System.out.println("******** Order By:"+condition);
  
          List&lt;RegisteredClassesTest&gt; registeredClassesView = registeredClassesService.getAccounts(search);
  
          paging.setRows(registeredClassesView);
      }else{
          paging.setRows(null);
      }
  
  
      paging.setRecords(String.valueOf(recordCount));
      paging.setPage(page);
      int total = recordCount % pageSize == 0 ? recordCount / pageSize : recordCount / pageSize + 1;
      paging.setTotal(String.valueOf(total));
  
      return paging;
  }
  </code></pre>