File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes printing from a JSP inside a frame Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "printing from a JSP inside a frame" Watch "printing from a JSP inside a frame" New topic
Author

printing from a JSP inside a frame

Timothy Lovern
Greenhorn

Joined: Nov 15, 2003
Posts: 4
I have an application, that is set up somewhat like a model view controller pattern.

A servlet is responsible for all the business logic, and a jsp is used to display theinformation to the user. (only rendering information is scripted inside the jsp)

The JSP is displayed within a frame, provided by another application. I cannot modify this application.

The JSP uses DIV's to force the output to fit within the frame and have scroll bars.

I need to be able to print the contents of the JSP page. Using the Windo.print() method from java script just gives me the portion of the frame that is visible. I need to print the entire jsp page, sans scroll bars, and not print anything my JSP is not responsible for.

In one situation, I know prior to displying the JSP that a print has been requested, in another, I don't. If the first situation is easiest to deal with, then I can probably get by with that for starters.

Thanks in advance.

Oh, I am learning HTML,JSP, Servlets, and JAVASCRIPT all at the same time on this project, so my knowledge base here is pretty weak.

Tim
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You can try to make a style sheet with the media print, when the page is printed this style sheet can hide the unwanted information.

http://www.meyerweb.com/eric/articles/webrev/200001.html

Eric
Timothy Lovern
Greenhorn

Joined: Nov 15, 2003
Posts: 4
Hmm, ok thanks!

Now to explore CSS.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: printing from a JSP inside a frame