• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

How to get the printer friendly version of a JSP

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Sheriff
Posts: 28333
97
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 28333
97
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I didnt quite get it! Can u give me some sample code???
 
Sheriff
Posts: 67752
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Discussion of CSS is best handled in the HTML forum, so this has moved there.
 
Hey, sticks and stones baby. And maybe a wee mention of my stuff:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic