How to make a page break after group change in table?


I want to print every group of a table on a new page but if I try it with page breaks jasperserver throws a Null Pointer Exception. Is there anyone who can help me?


Stacktrace (page break in the group footer):


java.lang.NullPointerException at net.sf.jasperreports.engine.fill.JRFillBand.isPageBreakInhibited( at net.sf.jasperreports.engine.fill.JRFillBreak.prepare( at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements( at net.sf.jasperreports.engine.fill.JRFillFrame.prepare( at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements( at net.sf.jasperreports.engine.fill.JRFillBand.fill( at net.sf.jasperreports.engine.fill.JRFillBand.fill( at net.sf.jasperreports.engine.fill.JRFillBand.refill( at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand( at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillGroupFooter( at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillGroupFooters( at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportContent( at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport( at net.sf.jasperreports.engine.fill.JRBaseFiller.fill( at net.sf.jasperreports.engine.fill.JRBaseFiller.fill( at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport( at at at java.util.concurrent.ThreadPoolExecutor$Worker.runTask( at java.util.concurrent.ThreadPoolExecutor$ at


robin.koch's picture
Joined: Apr 2 2013 - 6:16am
Last seen: 9 years 8 months ago

1 Answer:

Hi Robin,

I assume you are using the Table-Component as you wrote. I'm not very comfortable with this, but page breaking seams easy. Attach a dataset to the table having the group. Activate the property "Start on new page" with the dataset group you like. the table groups start on new pages now. see the example report attached (using foodmart jdbc datasource, works on the Jasperserver, too).

IMHO, Never ever user page breaks in Jasperreports!

Even if I don't know your report, i would say, better build a table-layout report without the table element, possibly as asubreport. You will have more control and flexibility like thi, although it may a bit more work to implement.

Cheers, Thomas

Thomas Zimmer's picture
Joined: Oct 2 2012 - 1:35am
Last seen: 3 days 17 hours ago

Thank you, that did it.

robin.koch - 9 years 10 months ago

Exactly what I was looking for thanks a lot.

Lwazi.Nxumalo - 6 years 10 months ago