This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes JSP and the fly likes Printing the contents of a JSP.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Printing the contents of a JSP...." Watch "Printing the contents of a JSP...." New topic
Author

Printing the contents of a JSP....

sailaja parepalli
Ranch Hand

Joined: Jan 23, 2003
Posts: 33
Hi,
I am trying to provide print functionality in my JSP. There should be a print button and when the user clicks this 'print' link/button it should pop-up a new window with the contents from the parent window.
I can pop-up the new window, but the problem here is I could not pass a java bean object to this window in order to display my contents on the new window.
I cannot print the contents of parent window directly, because the data is being displayed in the area with scrollbars (created using <div> tags).
Does anybody have a solution or sample code for this?
Thanks much.
--
Sailu
[ February 09, 2004: Message edited by: Bear Bibeault ]

Sailu<br />IBM 486, SCJP, Brainbench CJP
Anil Kumar
Greenhorn

Joined: Jan 17, 2004
Posts: 11
This is achievable through Javascript itself somethink like window.print()
Scroll bar should not be a concern as long as the content can fit on a normal size paper...I don't the use of opening a new window
Mani Ram
Ranch Hand

Joined: Mar 11, 2002
Posts: 1140
Originally posted by AnilKumar:
This is achievable through Javascript itself somethink like window.print()
Scroll bar should not be a concern

Scroll bars will create problem, if they are formed using DIV tags. Try it.
Sailu,
I don't understand what is the problem with accessing a Java bean object from the new window! Are you getting some errors?


Mani
Quaerendo Invenietis
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Printing the contents of a JSP....
 
Similar Threads
Capturing the current window's cotents??
Capturing the current window's cotents?
getting values from popup
Focus on child window after parent window gets refreshed
Enabling a button