aspose file tools*
The moose likes JSP and the fly likes Printing contents Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Printing contents" Watch "Printing contents" New topic
Author

Printing contents

Shailesh Pillai
Ranch Hand

Joined: Jan 24, 2006
Posts: 78
Hello Ranchers,

Can anyone suggest me how to print the contents i have on my jsp page to a printer.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60045
    
  65

On the client or the server?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Shailesh Pillai
Ranch Hand

Joined: Jan 24, 2006
Posts: 78
Both, on the client as well as on the server.
GS Chidam
Ranch Hand

Joined: Jul 07, 2006
Posts: 34
hi,

If your jsp page contain the data, just export to excel using jxl.write,
Class WritableWorkbook, then print.

What is your jsp contain? How you want to print?
Shailesh Pillai
Ranch Hand

Joined: Jan 24, 2006
Posts: 78
My jsp displays data(from database) in a tabular format. In my jsp page, I do have some headings and other stuff, but i only want the data in tabular format to be printed.

How about the PrinterJob class?
Chetan Parekh
Ranch Hand

Joined: Sep 16, 2004
Posts: 3636
Use JasperReports with iReport.


My blood is tested +ve for Java.
GS Chidam
Ranch Hand

Joined: Jul 07, 2006
Posts: 34
using jxl.write, just export to excel then print.

Already you are having jsp display data in the List isn't, use that data, Export to excel.

The example code something like this.


response.setContentType("application/vnd.ms-excel;charset=UTF-8");
response.setHeader("Content-Disposition", "attachment;filename=dfs.xls");
WritableWorkbook w = Workbook.createWorkbook(response.getOutputStream());

WritableSheet s = w.createSheet("sheet name", 0);

WritableFont wfTitle = new WritableFont(
WritableFont.ARIAL, 14);
Label l1;

WritableCellFormat cfTitle = new WritableCellFormat(wfTitle);
l1= new Label(0,0,"abc",cfTitle);
s.addCell(l1);
Shailesh Pillai
Ranch Hand

Joined: Jan 24, 2006
Posts: 78
Thanks all for your reply.
 
wood burning stoves
 
subject: Printing contents
 
Similar Threads
asp
Silk test 8 doesnt recognizes objects in firefox 2
Book Promo: does it have a table of contents?
Mr.Kyte, could you introduce a little about your book?
Book Content