Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7499671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T19:54:11+00:00 2026-05-29T19:54:11+00:00

I am using JasperReports with Spring MVC for reporting in my application. Basically I

  • 0

I am using JasperReports with Spring MVC for reporting in my application.
Basically I first design reports in iReport 4.1.1 and then put the resulting .jasper file in my class path via jasper-view.xml

When the request comes, the controller puts the required parameters from Session to Parameter Map and generates report.

The scenario is there are about 15 subreports in my main report.
Out of all these reports, only reports which match the criteria (passed as parameters) are printed (controlled via “Print When” option of the Band)

And my question is: if my report is not to be printed does it gets executed (i.e. the query inside it)?
or is it simply skipped?

My reason for asking this question is that report generation takes quite a long time (around 2s, which is too long for my application according to me).

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T19:54:12+00:00Added an answer on May 29, 2026 at 7:54 pm

    If you look at the source code for ‘Jasper Reports’, the logic says that the ‘printWhenExpression’ is evaluated first and then the report element is filled, if it is to be printed.

    Below is a method called ‘fillNoData‘ from JRVerticalFiller.java (version 4.0), which says so:

    private void fillNoData() throws JRException
        {
            if (log.isDebugEnabled() && !noData.isEmpty())
            {
                log.debug("Fill " + fillerId + ": noData");
            }
    
            noData.evaluatePrintWhenExpression(JRExpression.EVALUATION_DEFAULT);
    
            if (noData.isToPrint())
            {
                while (noData.getBreakHeight() > pageHeight - bottomMargin - offsetY)
                {
                    addPage(false);
                }
    
                noData.evaluate(JRExpression.EVALUATION_DEFAULT);
    
                JRPrintBand printBand = noData.fill(pageHeight - bottomMargin - offsetY);
    
                if (noData.willOverflow() && noData.isSplitPrevented() && isSubreport())
                {
                    resolveGroupBoundElements(JRExpression.EVALUATION_DEFAULT, false);
                    resolveColumnBoundElements(JRExpression.EVALUATION_DEFAULT);
                    resolvePageBoundElements(JRExpression.EVALUATION_DEFAULT);
                    scriptlet.callBeforePageInit();
                    calculator.initializeVariables(ResetTypeEnum.PAGE, IncrementTypeEnum.PAGE);
                    scriptlet.callAfterPageInit();
    
                    addPage(false);
    
                    printBand = noData.refill(pageHeight - bottomMargin - offsetY);
                }
    
                fillBand(printBand);
                offsetY += printBand.getHeight();
    
                while (noData.willOverflow())
                {
                    resolveGroupBoundElements(JRExpression.EVALUATION_DEFAULT, false);
                    resolveColumnBoundElements(JRExpression.EVALUATION_DEFAULT);
                    resolvePageBoundElements(JRExpression.EVALUATION_DEFAULT);
                    scriptlet.callBeforePageInit();
                    calculator.initializeVariables(ResetTypeEnum.PAGE, IncrementTypeEnum.PAGE);
                    scriptlet.callAfterPageInit();
    
                    addPage(false);
    
                    printBand = noData.fill(pageHeight - bottomMargin - offsetY);
    
                    fillBand(printBand);
                    offsetY += printBand.getHeight();
                }
    
                resolveBandBoundElements(noData, JRExpression.EVALUATION_DEFAULT);
            }
        }
    

    What you need to look into, is how the usage of subreports affects performance and memory usage. It looks like you have too many subreports embedded in the main report. Here’s something from this JasperForge link:

    Is there performance concerns with Subreports?

    The answer to this depends on your system, data source and your report
    design. A few points to note on Subreports:

    • Each subreport execution may spawn a new thread (see below).
    • As the subreport executes more objects will be created in Heap Memory.

    On the subject of threads. Support for Java continuations has been
    added as an alternative to threads. This was done using the Jakarta
    Commons Javaflow library. The JasperReports property:
    net.sf.jasperreports.subreport.runner.factory can be used with the
    following two settings:

    • net.sf.jasperreports.engine.fill.JRContinuationSubreportRunnerFactory
    • net.sf.jasperreports.engine.fill.JRThreadSubreportRunnerFactory

    By default
    net.sf.jasperreports.engine.fill.JRThreadSubreportRunnerFactory is
    used, however if
    net.sf.jasperreports.engine.fill.JRContinuationSubreportRunnerFactory
    is set, then a Javaflow approach will be used to fill the reports
    rather than threads. If this option is choosen, then the Jakarta
    Commons Javaflow jar must be included in the application classpath.
    This jar can be found in the lib directory of the JasperReport reports
    project distribution package. The jasperreports-javaflow.properties
    file illustrates how this property could be set in a actual
    implementation. Other alternatives for processing different queries in
    the same report are usage of the List element and Sub Datasets.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a reporting web application using JasperReports and Spring MVC. Now, i
I'm working on a reporting web application using JasperReport and Spring MVC 3 to
I am prototyping a web application using Spring MVC 3.0 with JasperReports. I have
I'm using JasperReports with JavaBeans (I need to print reports in a application that
I'm using Web Services to run some reports created in iReport on JasperReports Server.
I've briefly looked at using Jasper Reports as a reporting engine. However it's all
I'm using Jasper Reports within Spring. Is it possible to let Jasper generate the
I have a j2ee application using spring framework. I am trying to export jasper
We are using JasperReports as our reporting tool. Earlier we were using relative paths
We are currently using Jasper Reports to generate PDF 417 barcodes using Barcode4j. We

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.