1
votes
<action name="myJasperTest" class="com.focus.web.action.asset.AssetAction" method="setData">
     <result name="success" type="jasper">
          <param name="location">reports/check_list/Check_List.jasper</param>
          <param name="connection">connection</param>
          <param name="dataSource">myList</param>
          <param name="format">HTML</param>
     </result>
</action> 

This is my struts action for displaying the jasper report. I am using a embed SQL in jasper report. So then I will have to set connection param. Since I am using Spring in project I did auto-wired to data-source and returned a connection from my respective action class and what should be the value for dataSource?

I am not having any list need to send report from action class and if I don't mention the dataSource it says dataSource is not defined.

1

1 Answers

0
votes

The value of dataSource should be the list of objects. For example

//List to use as JasperReports dataSource parameter.
private List<MyBean> myDataSource;

public List<MyBean> getMyDataSource() {
    return myDataSource;
}

This is not a dataSource bean used by the Spring to manage connections.

the connection parameter is available since version 2.1.7:

connection - (2.1.7+) JDBC Connection which can be passed to the report instead of dataSource