title: Data error while tring to display a YUI DataTable in Spring MVC
body: <p>I am doing a project regarding Spring and YUI Data table. </p>
  
  <p>I am using controller to return JSON string and at the view will use the JSON string as data source to generate a data table. But somehow the data table displays "Data error".</p>
  
  <p>Here is the code for my <strong>controller</strong>:</p>
  
  <p>@RequestMapping(value = "/report")
          public ModelAndView getViolationReport(Long violation_num){</p>
  
  <pre><code>        ComplLog origViolation = null;
          //HashMap&lt;Long, BRMap&gt; logdetailsmap = new HashMap&lt;Long, BRMap&gt;();
  
          Map&lt;String,String&gt; map = new HashMap&lt;String, String&gt;();
  
          map.put("col1", "value1");
          map.put("col2", "value2");
          map.put("col3", "value3");
          map.put("col4", "value4");
          map.put("col5", "value5");
  
          List&lt;Map&lt;String,String&gt;&gt; list = new ArrayList&lt;Map&lt;String,String&gt;&gt;();
          list.add(map);
  
          ModelAndView mav = new ModelAndView();
  
          mav.addObject("detailList", list);
          mav.setViewName("GetViolationReport");      //return the model to the GetViolationReport.jsp          
          return mav;
  }
  </code></pre>
  
  <p>Here is my index.jsp file:</p>
  
  <pre><code>&lt;% response.sendRedirect("/app/ViolationReportService.app"); %&gt;
  </code></pre>
  
  <p>Here is my view, GetViolationReport.jsp:</p>
  
  <pre><code>&lt;body class="yui-skin-sam" topmargin="0" leftmargin="0" marginheight="0" marginwidth="0"&gt;
  &lt;div id="scroller" class="scrollPane"&gt;
      &lt;c:out value = "${detailList}" /&gt;    
  &lt;/div&gt;
  &lt;div id="basic"&gt;&lt;/div&gt; 
  &lt;/body&gt;
  &lt;script type="text/javascript"&gt;
  YAHOO.util.Event.addListener(window, "load", function() {
  YAHOO.example.Basic = function() {
      var myColumnDefs = [
          {key:"col1", sortable:true, resizeable:true},
          {key:"col2", sortable:true, resizeable:true},
          {key:"col3", sortable:true, resizeable:true},
          {key:"col4", sortable:true, resizeable:true},
          {key:"col5", sortable:true, resizeable:true}
  
      ];
   var myDataSource = new YAHOO.util.XHRDataSource("app/violationreport/report");
      myDataSource.responseType = YAHOO.util.XHRDataSource.TYPE_JSON;
      myDataSource.responseSchema = {
          metaFields : {
              totalRecords : "detailmap.totalRecordsFound",
              recordsReturned : "detailmap.totalRecordsFound",
              invocationStatus : "invocationStatus",
              startIndex : 0,
              executionStatusMessage : "executionStatusMessage"
          },
          resultsList : "detailList",
          fields : [ "col1","col2","col3","col4","col5" ] 
      }
  var myDataTable = new YAHOO.widget.DataTable("basic",
              myColumnDefs, myDataSource, {initialLoad: true, caption:"DataTable Caption"});
  
      return {
          oDS: myDataSource,
          oDT: myDataTable
      };
   }();
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>And the actoolkit-config.xml is like this:</p>
  
  <pre><code>&lt;bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"&gt;
      &lt;property name="favorParameter" value="true" /&gt; 
      &lt;property name="mediaTypes"&gt;
          &lt;map&gt;
              &lt;entry key="json" value="application/json" /&gt; 
              &lt;entry key="html" value="text/html" /&gt; 
              &lt;entry key="plain" value="text/plain" /&gt; 
              &lt;entry key="octet" value="application/octet-stream" /&gt; 
          &lt;/map&gt;
      &lt;/property&gt;
      &lt;property name="viewResolvers"&gt;
          &lt;list&gt;
              &lt;!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory --&gt;
              &lt;bean class="org.springframework.web.servlet.view.UrlBasedViewResolver"&gt;
                  &lt;property name="viewClass"
                      value="org.springframework.web.servlet.view.JstlView" /&gt;
                  &lt;property name="prefix" value="/WEB-INF/jsp/" /&gt;
                  &lt;property name="suffix" value=".jsp" /&gt;
              &lt;/bean&gt;
          &lt;/list&gt;
      &lt;/property&gt;
  
      &lt;property name="defaultViews"&gt;
          &lt;list&gt;
              &lt;bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView" /&gt;                   
          &lt;/list&gt;
      &lt;/property&gt;
      &lt;property name="defaultContentType" value="application/json" /&gt; 
  &lt;/bean&gt;
  </code></pre>
  
  <p>There is no error in the console, but when i go to the url that supposed to generate the data table, it displayed a data table with columns I defined but content showes "Data error".</p>
  
  <p>Can someone please help me with this?</p>