aspose file tools*
The moose likes Servlets and the fly likes hello! :) it's me again... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "hello! :) it Watch "hello! :) it New topic
Author

hello! :) it's me again...

michael jordan
Greenhorn

Joined: May 10, 2001
Posts: 5
hello, i just wanted to ask this another question. Well, as you see i able to understand a lot about jsp's. I just wanted to ask about how to print my data in a jsp page, if possible could i also print it using a applet? thanks a lot
kichu kichu
Ranch Hand

Joined: May 10, 2001
Posts: 59
Well ,
<%
out.println("Michael Jordan");
%>
This is the way to print in a jsp page.

bye,
kichu.
michael jordan
Greenhorn

Joined: May 10, 2001
Posts: 5
Ahh kichu thanks , i'm sorry I didn't explained it well what I am trying to say. I mean, I wanted to print it in a "hardcopy" paper. Or should I say I want to use the "printer" so I can print my data using a printer which comes from the jsp.
to kichu, thanks anyway... for your concern
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
To get a better idea of what you want, in what way is just clicking the "print" button in your browser once the page has appeared not good enough? I guess you must want more than that, but what exactly do you need?


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
michael jordan
Greenhorn

Joined: May 10, 2001
Posts: 5
I want to print my data in the printer in a way that it is organized.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
I'm sorry, I still don't quite understand. Organized in what way? What sort of data do you need to print ? Can you perhaps give an example of how you would like the information to appear on the browser screen, and how (if different) you would like it to appear on the printer page.
Thanks.
Poornima Shetty
Greenhorn

Joined: Dec 12, 2000
Posts: 26
Hi Michael,
If you have a JSP page say test1.jsp that has some data in it, be it just html code or the java code embedded in html
,all you have to do is say you have a print button in your test1.jsp.Onclick of that call a javascript function as
below and redirect it to some jsp say test2.jsp which will have the same data as test1.jsp.

test1.jsp
**********
function printData()
{
document.location.href="test2.jsp";
}

Then in test2.jsp on body load call a print function as below:

function printPage()
{
window.print();
history.go(-1);
}

all this function does is,when you click on the print button in test1.jsp the printData() function gets called which
moves to test2.jsp where in on body load you call printPage() function which opens a print window where if you click
the OK button then the page gets printed and control is moved back to test1.jsp.Note the user will never get a chance
to edit test2.jsp as on body load only you call the print function.Hope this is not cifusing and is of some help to you....

.....P......

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: hello! :) it's me again...