0

ここでは、カスタム クラスまたはパラメーターのみを Jasper テンプレートに渡したいのですが、データ ソースがないと、レイアウトのない空白の pdf ファイルしか表示されないようです。

jrxmlのデフォルト値whenNoDataTypeが「nopage」であるためだと思いますが、設定しても

whenNoDataType="AllSectionsNoDetail"

詳細バンドにはまだ何も表示されていませんが、タイトル バンドのみが表示されています。

これを解決する方法を尋ねることはできますか?

前もって感謝します。

4

1 に答える 1

0

自分で解決

空のデータソースを指定すると、魅力的に機能します

// We must have an empty data source to make sure the layout can show up
    // otherwise will have a blank pdf file
    List<Object> emptyList = new ArrayList<Object>();
    Object nothing = null;
    emptyList.add(nothing);
    JRBeanCollectionDataSource jRBeanCollectionDataSource = new JRBeanCollectionDataSource(emptyList,false); 

    // This is declared inside the spring/jasper-views.xml
    model.put("datasource", jRBeanCollectionDataSource);
    modelAndView = new ModelAndView("pdfReport", model);
于 2012-06-19T17:35:45.537 に答える