Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Page Number on JSP

 
Terence Chan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,

I am trying to display page number on a jsp for a report task. Can any help?

PS
I know I can let IE do the page number display but is there any other way of doing it?
 
Travis Hein
Ranch Hand
Posts: 161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The page number in IE, and Mozillla is an artifact of when the browser paginates the screen to fit onto paper when printing it.

If you have a report output and a JSP is rendering it as a long list on one page, you could have the logic that prints out the table in the JSP page to break up the table within the output, so that you can calculate the page number and display it.

for example,
 
Paul Clapham
Sheriff
Posts: 21416
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have no way, on the server, of knowing how the browser is going to paginate your HTML output when it prints it. The user can direct the browser to change font size, to print in landscape instead of portrait mode, and so on. If you want to control the pagination then HTML is not the right tool. PDF would work better for that.
 
Scott Selikoff
author
Saloon Keeper
Posts: 4028
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are ways of estimating it (MapQuest does a decent job at this) so you might be able to get close for practical purposes, but it'll never be precise. The best way, as previously mentioned, is to use PDF/PS exports.
 
Terence Chan
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Travis, Paul, and Scott

First of all, thanks for all of your replies. Moreover, I am very interested in learning more on Travis sugguestion (Since I don't want to rewrite my whole program using pdf)! Appriecate if travis could give me detail (A complete example) on the solution.

Terence
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess using a third-party open source report frameworks is your best bet.
Like JasperReports, or JFreeReports
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic