我正在使用spring mvc。我希望当我在输入字段后单击“提交”按钮时,然后在一个视图(浏览器选项卡)或两个视图中生成两个不同的jasper报告,众所周知。
使用以下代码,当我提交表单时,只有两个报告显示一个报告。我想显示两个差异。像现在一样在一两个视图中显示报告(pdf)。请查看问题。
My controller is like :
Session session = null;
Map<String, Object> parameterMap = new HashMap<String, Object>();
Map<String, Object> parameterMap1 = new HashMap<String, Object>();
JasperReportsPdfView view = new JasperReportsPdfView();
view.setUrl("classpath:/jReport/stock_issuance_toDepartment.jrxml");
view.setApplicationContext(applicationContext);
JasperReportsPdfView view1 = new JasperReportsPdfView();
view1.setUrl("classpath:/jReport/requirement_order.jrxml");
view1.setApplicationContext(applicationContext);
session = sessionFactory.openSession();
String hql = "FROM Stock_issuance_toDepartment";
String hql1 = "FROM Order_Type_Entity";
Query query = session.createQuery(hql);
Query query1 = session.createQuery(hql1);
List list = query.list();
List list1 = query1.list();
JRDataSource JRdataSource = new JRBeanCollectionDataSource(list);
parameterMap.put("datasource", JRdataSource);
JRDataSource JRdataSource1 = new JRBeanCollectionDataSource(list1);
parameterMap1.put("datasource", JRdataSource1);
mav = new ModelAndView(view, parameterMap);
mav = new ModelAndView(view1, parameterMap1);
return mav;
我的预期结果是:将会生成两个不同的报告(例如:view和view1),并显示在一个视图(在浏览器选项卡中)或两个视图中,这据您所知。提前致谢。