View Full Version : Problem in Spring with JasperReports: crosstab not appearing in Html
Ryoma Echizen
Jul 17th, 2007, 03:05 AM
Hi guys,
I created a crosstab report using iReport. I used the generated jrxml in my Spring web app.
It wouldn't appear in the browser whenever I run the app! :( To see if the jrxml is at fault, I generated an iReport html file and it worked well.
I noticed in the iReport folders that a report_name.html_files folder is created and has a "px" file in it. I think Spring is not generating the same.
Any ideas/techniques that will solve this?
Thanks in advance!
RE
noon
Jul 17th, 2007, 11:56 AM
The problem can be "anywhere".
Try to post your applications Bean configuration(s) and the java code how you're using the jrxml-files.
I had also some problems in jrxml files, but I solved this by compiling the jrxml files to jasper files which my spring app uses.
dr_pompeii
Jul 17th, 2007, 01:19 PM
I noticed in the iReport folders that a report_name.html_files folder is created and has a "px" file in it. I think Spring is not generating the same.
like the previous author said, you should work with the .japer files instead of .jrxml files
yes you right, the folder has and use a photo to fill in the report(maybe the cross tabs, i dont know),
your problem is to create with type of view html right????
the solution should be to tell spring that should use the photo that exists in the folder and is need it for html report, if you work with pdf view, i guess that the error shouldnt appear
i cant help ypu more, i only rk with pdf reports
regards
Ryoma Echizen
Jul 17th, 2007, 09:36 PM
Hi! Here's the bean configuration:
<bean id="Report7a" class="org.springframework.web.servlet.view.jasperreports .JasperReportsHtmlView">
<property name="url" value="templates/Report7a.jrxml"/>
<property name="exporterParameters">
<map>
<entry key="net.sf.jasperreports.engine.export.JRHtmlExporterP arameter.IS_USING_IMAGES_TO_ALIGN">
<value>false</value>
</entry>
</map>
</property>
</bean>
and the java code snippet:
....public ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse response) throws Exception {
String report = "Report" + request.getParameter("reportCd");
return new ModelAndView(report, getModel(request));
}
private Map getModel(HttpServletRequest req) {
HashMap map = new HashMap();
Connection connection;
Statement statement;
ResultSet resultSet = null;
String query = "";
try {
String reportType = req.getParameter("reportCd");
query = props.getProperty(reportType);
connection = dataSource.getConnection();
statement = connection.createStatement();
resultSet = statement.executeQuery(query);
} catch (SQLException e) {
e.printStackTrace();
}
JRResultSetDataSource resultSetDataSource = new JRResultSetDataSource(
resultSet);
map.put("datasource", resultSetDataSource);
return map;
}
Dr Pompeii: I tried it in pdf view and still it doesn't show.
I just noticed that embedding the sql statement in jrxml doesn't work when running in Spring. The statement has to be run in java and only the resultset will be passed to the jrxml. In crosstabs, the statement is inside the subDataset element. When passing the resultset, how do I indicate that it is for the subDataset query string?
Thanks.
RE
dr_pompeii
Jul 21st, 2007, 11:00 AM
sorry by the late of my reply
Dr Pompeii: I tried it in pdf view and still it doesn't show.
really weird, in the book code of jasper report works fine, i never tested this with spring(spring + pdf+ crosstabs),but if the lines of the crosstabs are an image , i cant help you, coz i dont know how call this reference.
I just noticed that embedding the sql statement in jrxml doesn't work when running in Spring. The statement has to be run in java and only the resultset will be passed to the jrxml.
again, you should work with the .jasper instead of the ,jrxml file
private Map getModel(HttpServletRequest req) {
HashMap map = new HashMap();
Connection connection;
Statement statement;
ResultSet resultSet = null;
String query = "";
try {
String reportType = req.getParameter("reportCd");
query = props.getProperty(reportType);//how works this??
connection = dataSource.getConnection();
statement = connection.createStatement();
resultSet = statement.executeQuery(query);
} catch (SQLException e) {
e.printStackTrace();
}
In crosstabs, the statement is inside the subDataset element. When passing the resultset, how do I indicate that it is for the subDataset query string?
no idea, i had problems with subreports with spring, a nightmare, i never found a soltuion, my trick is work with groups in the jrxml before to compile to jasper of course, i dont know if this hell is the same with subreports
now i see that you are using JRResultSetDataSource, avoid that, you soon or late will have a party of lack of resources
pls see this link
http://forum.springframework.org/showthread.php?t=40499
see carefully all
regards
Ryoma Echizen
Jul 22nd, 2007, 09:17 PM
Ok. Thanks. I'll look into this carefully.
Cheers!
RE
dr_pompeii
Jul 22nd, 2007, 11:20 PM
Ok. Thanks. I'll look into this carefully.
dont worry, let me know your progress
best wishes
vBulletin® v3.7.3, Copyright ©2000-2008, Jelsoft Enterprises Ltd.