Support > Repository > Form > PDF output using JasperReports (2) List display
ja | en

Explain handling of list display using JasperReports.

This document is "PDF output using JasperReports (1) Detailed displayOn the premise of the knowledge of "List display data handling different points will be explained.

How to use JasperReports and how to design a form is not subject to Wagby support.Please consult Wagby dealer who has JasperReports engineer.At some agencies, training courses such as training are being held.

Sample data in XML format

  1. Launch the built Wagby application.
  2. Wagbyapp \ webapps \ wagby \ $ (model name) \ showList $ (model name) Opens _body.jsp with a text editor.Notepad attached to Windows can not be used.Please use a text editor such as TeraPad.
  3. Add two lines <c: out value = "$ {(model name) _lp}" /> and <c: out value = "$ {model name) _ cp}" />.The former is list display data and the latter is search condition data.Here is an example of the customer model.
    <%@ page pageEncoding="UTF-8" %>
    <fmt:setBundle basename="jfcapp"/>
    <c:out value="${customer_lp}"/>
    <c:out value="${customer_cp}"/>
  4. Log on to the application and open the list screen of this model.Data in XML format is displayed at the top of the screen.This is the test data used for form layout design in Jaspersoft Studio.
  5. Use the mouse to select and copy the displayed XML data.Save the data as a text file.(The file name is a combination of half-size alphanumeric characters and the extension is ".xml".) The character code is utf-8.
  6. In addition, add the following two lines to the beginning of this text file.
    <?xml version="1.0" encoding="utf-8"?>
  7. Add the following line to the last line.

In the following description, it is assumed that the test data for the list form is saved as "c: \ customer_showlist.xml".

<?xml version="1.0" encoding="utf-8"?>
  <customer_lp sortable="customerid " sort="" order=""><!-- 一覧表示用のデータ -->
  <customer_cp><!-- 検索条件として入力した値 -->
    <customerid1jshparam errorcode=""></customerid1jshparam>
    <customerid2jshparam errorcode=""></customerid2jshparam>
    <name errorcode=""></name>

In the list display, an item element is prepared for each data.There are ten item elements if there are ten display data.

Explain the differences from the detailed display setting.

Data Adapter Wizard

Prepare the data source "XML document".In the example we will name the name "showListCustomer" and associate it with customer_showlist.xml.

The difference from the detailed display setting is to write/root/customer_lp/item in the Select Expression field.

Figure 1 Data Adapter Wizard Setting Screen

Dataset and Query

Since we have specified Select Expression in Figure 1, we only need to specify the description of each field for the rest of the field.

Figure 2 Dataset and Query Dialog


All settings can be confirmed on the Source tab.Here is an example of setting the list form.

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version last-->
<jasperReport xmlns="" xmlns:xsi="" xsi:schemaLocation="" name="showListCustomer1" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="b7ae9a9e-9321-4dc5-9b76-e4fa9877d839">
  <property name="" value="showListCustomer"/>
  <property name="" value=""/>
  <queryString language="xPath">
  <field name="Field_1" class="java.lang.String">
    <band splitType="Stretch"/>
    <band height="79" splitType="Stretch"/>
    <band height="35" splitType="Stretch"/>
    <band height="61" splitType="Stretch"/>
    <band height="125" splitType="Stretch">
        <reportElement x="180" y="30" width="100" height="20" uuid="84eea6ac-1884-4e4c-87b5-45f1064327d9"/>
          <font pdfFontName="HeiseiKakuGo-W5" pdfEncoding="UniJIS-UCS2-H"/>
    <band height="45" splitType="Stretch"/>
    <band height="54" splitType="Stretch"/>
    <band height="42" splitType="Stretch"/>

Since the reference XPath (/ root/customer_lp/item) has already been specified in the list form, "Description" is only the item name.

Item type Inscription Description Specification example
String, number, date item name The value of the item is posted. customer_name
Model reference (except check box) Item name/@ content The content part is posted. companyname/@content
Item name/@ id The ID part of the model is posted. companyname/@id
Model reference (check box) Item name [subscript]/@ content The content part of the model corresponding to the subscript is posted.Subscript starts from "1". customertype[2]/@content
Item name [subscript]/@ id The ID part of the model corresponding to the subscript is posted.Subscript starts from "1". customertype[2]/@id
Repeat item Item name [subscript] The value of the repetition item corresponding to the subscript is posted.Subscript starts from "1". email[2]/@content
Items in the repeating container Item name of container [subscript]/item name The value of the item in the repeating container corresponding to the subscript is posted.Subscript starts from "1". report[2]/rdate

JasperReports has a database connection function by JDBC.By using SQL, you can also operate the table generated by Wagby directly to collect data and output the report.

We do not set up JDBC in Japsersoft Studio.You can specify SQL for the queryString element of the configuration file jrxml as follows.

<parameter name="juser_cp.userid" isForPrompting="true" class="java.lang.String">
  <defaultValueExpression ><![CDATA["admin"]]></defaultValueExpression>

<queryString><![CDATA[select * from "juser" where "userid" = $P{juser_cp.userid}]]></queryString>

Enclose the table name and item name in double quotes.Parameters can also be specified with the notation $ P {...}. "Model name _ cp" refers to the model that stores the search condition.

"Form> PDF output using JasperReports (1) Detail display> Version of library to usePlease read.

An empty form is output

There is an error in the description of queryString in the configuration file jrxml.Please check whether it is a misspelling or a correct model name.

Example: The following setting is a list form targeting the customer model, but the following notation of root is incorrect.

<queryString language="xPath">

It is correct as follows.

<queryString language="xPath">