Jump to content
We've recently updated our Privacy Statement, available here ×

Please post jsp file subreport &master report


2005 IR Help

Recommended Posts

By: itsmeprash - itsmeprash

Please post jsp file subreport &master report

2004-08-20 09:11

Can anybody post a jsp example with a subreport and master report. I am trying to use the webapp example that comes with jasper0.6.0 but invain.

 

for some reason i am not seeing the subreport with jasper report.

 

I don't see any exception. This means i am doing everything right then why is it not showing up. Looks like there are somemany of you who are good at it. Can you please post a jsp example with one or more subreports.

 

 

I purchased the $35 book from jasperreport but it is of no use at all.

 

thanks in advance

Prash.

 

 

 

 

By: Chuck Deal - cdeal

RE: Please post jsp file subreport &master report

2004-08-23 04:16

Have you gotten the report to work outside of the web environment.

 

Preferably using ant?

 

If so, then perhaps you could tell us about your web env.

 

If you have NOT gotten your report to run yet, then focus on that first. You can modify the sample driver classes to run your own reports.

 

 

 

 

By: itsmeprash - itsmeprash

RE: Please post jsp file subreport &master report

2004-08-23 07:11

Thanks for you reply Chuck.

 

My report works fine in the Web Environment.

What perplexed me was the Master Report was not showing the subreport at all.

 

Things i tried to get it fixed.

 

1) User JasperFillManager.fillReport on the subreport in the JSP file.

 

2) Most of the times there is a lot of business logic that goes on in the backend, and a bean is populated with the data that needs to be shown in the presentation layer. Since i was not using SQL and was using a bean as a datasource and there was not example showing one to pass to a subreport i really wasted a lot of time.

 

3) The heading text did not show up, only for the reason that the datasource was not passed.

 

Suggestions:

 

1) I wish there was a debug mode where the subreport or any reporting components in the system should be shown color coded.

 

For eg., the subreport was not showing up in my case as i had not passed the datasource to the subreport. But i was expecting the simple ordinary text elements to show up. In debug mode it should how the subreport not matter what but in red, with some text showing the reason why it cannot be shown.

 

2) Some kind of logging in the code, Log4j enabled so we can increase or decrease the logging level to help us more as to where the code is failing on us.

 

3) The best thing about open source is that even if we get stuck with something we always know where we are in trouble and fix it ourselves. So good logging will show where exactly there is trouble.

 

Theodor should have more examples on his website or in the build with the bean as a datasource.

 

This is for all of those who are struggling

 

The report engine expects that the data source expression returns a

net.sf.jasperreports.engine.JRDataSource object and that the connection expression returns a

java.sql.Connnection object, whichever is present.

 

<subreport isUsingCache="true">

<reportElement positionType="Float" x="335" y="25" width="175" height="20" isRemoveLineWhenBlank="true"/>

<dataSourceExpression><![CDATA[$P{MyDataSource}]]></dataSourceExpression>

<subreportExpression class="net.sf.jasperreports.engine.JasperReport"><![CDATA[$P{AssociatedQARSubreport}]]></subreportExpression>

</subreport>

 

The most important line is "dataSourceExpression"

 

Hope this helps

 

Prash.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...