This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Building Blockchain Apps and have Michael Yuan on-line!
See this thread for details.
Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

Page Number on JSP

 
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?
 
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,
 
Marshal
Posts: 25215
64
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.
 
author
Posts: 4173
29
jQuery Eclipse IDE Java
  • 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
 
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
 
Whatever you say buddy! And I believe this tiny ad too:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!