We have faced the problem of displaying the "Page x of y" in the summary band of our reports. We have started implementing this using a post from the jasper forum: http://jasperforge.org/plugins/espforum/view.php?group_id=102&forumid=103&topicid=18975 . This was not enough however because the pageCount variable expression would not be evaluated when a summary page was encountered, so we overcome this by using a initial value expression like that : ($V{pageCount} == null) ? 0 : $V{pageCount} + 1.
The $V{pageCount} is null the first time the variable is initialised, so the pageCount variable is set to 0. This did not matter because the value of the variable would be set again according to the pageCount variable expression to be equal to the value of the PAGE_NUMBER variable.
The second case is really interesting, because when a summary page is encountered the pageCount variable value is not the one defined in the pageCount variable expression, but the one defined in the initial value expression. Now, the test $V{pageCount} == null returns false and the pageCount value is set to $V{pageCount} + 1 which is printed in the footer of the page. Next, if there is another summary page is process is continued, printing the correct page in the footer.