title: Showing multiple table jasper report via spring
body: <p>I am new in Jasper report.
  I successfully displaying one table with jasper report. 
  But how to display multiple table in jasper report via Spring Controller?</p>
  
  <p>I'm not using database as data source, just plain POJO in ArrayList.</p>
  
  <p>This is my Spring configuration</p>
  
  <pre><code>@Configuration
  public class JasperReportConfig {
  
      @Bean
      public JasperReportsViewResolver getJasperReportsViewResolver() {
        JasperReportsViewResolver resolver = new JasperReportsViewResolver();
        resolver.setPrefix("classpath:/reports/");
        resolver.setSuffix(".jrxml");
        resolver.setViewNames("report_*");
        resolver.setViewClass(JasperReportsMultiFormatView.class);
        resolver.setOrder(0);
        return resolver;
      } 
  
  }
  </code></pre>
  
  <p>And this is my Controller. </p>
  
  <pre><code>@Controller
  public class MyReportController {
  
      @RequestMapping("/thereport")
      public ModelAndView showReport(ModelAndView mv) {
  
  
          // the first list to be the first table
          List&lt;Person&gt; theFirstList = new ArrayList&lt;&gt;();
          theFirstList.add(new Person("Joni", "Jakarta"));
          theFirstList.add(new Person("Michel", "Singapore"));
          mv.addObject("dataSource", theFirstList);
  
          // the second list to be the second table
          List&lt;Person&gt; theSecondList = new ArrayList&lt;&gt;();
          theSecondList.add(new Person("Annie", "Thailand"));
          theSecondList.add(new Person("Barry", "India"));
          mv.addObject("dataSource", theSecondList); 
  
          mv.addObject("format", "pdf");
          mv.setViewName("report_address");
  
          return mv;
      }
  
  }
  </code></pre>
  
  <p>Person class</p>
  
  <pre><code>import lombok.AllArgsConstructor;
  import lombok.Getter;
  import lombok.NoArgsConstructor;
  import lombok.Setter;
  
  @AllArgsConstructor
  @NoArgsConstructor
  @Getter
  @Setter
  public class Person {
  
      private String name;
  
      private String address;
  
  }
  </code></pre>
  
  <p>How to define a different dataSource so that i can use two (or more) list in report? Or maybe i can use one dataSource that contain multiple list in it?</p>