• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to get the printer friendly version of a JSP

 
Srini Nivas
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am generating a JSP that contains dynamic data in tables. The tables can be sorted. Now I what to have a link that displays the printer friendly version of that sorted data. How can I do this?
 
Paul Clapham
Sheriff
Pie
Posts: 20739
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is up to you. First, decide what is printer-unfriendly about how your current page looks. Next, make a new design that looks better on the printer. Write a new JSP to produce that design and provide a link to that JSP. (And finally, throw away the original JSP and just use the new and improved one.)

The only time I have seen "printer-friendly" on web pages is where the normal version is text (like a magazine article) divided into several linked pages covered with advertising and the printer-friendly version has all the text on a single page. Does that describe your situation?

It's also possible to use CSS in such a way that irrelevant parts of your JSP's output, like a column of links or "delete" checkboxes for example, do not appear in printed versions of the output.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For more information about doing this with CSS :
Going to print
 
Srini Nivas
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks....I will try writing a new JSP......I have to remove the header and some gif's from my original JSP, also the sortable links in the tables for my printer friendly version. I am not sure how to use style sheets for that.....!!!
 
Paul Clapham
Sheriff
Pie
Posts: 20739
30
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Srini Nivas:
Thanks....I will try writing a new JSP......I have to remove the header and some gif's from my original JSP, also the sortable links in the tables for my printer friendly version. I am not sure how to use style sheets for that.....!!!
If that's all you want to do then I think you should definitely use the CSS method. If your HTML is littered with <font> tags and other layout controls, then you should really rewrite it to use CSS anyway. Here's the piece of my CSS that controls the print format:This says that elements like <TH class="links"> etc. will not appear in printed versions of the page. But follow the link that Satou provided (and links from that page as well) for details.
 
Srini Nivas
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didnt quite get it! Can u give me some sample code???
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64620
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Discussion of CSS is best handled in the HTML forum, so this has moved there.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic