• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Bear Bibeault
  • Liutauras Vilda
  • Devaka Cooray
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

Printing contents

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers,

Can anyone suggest me how to print the contents i have on my jsp page to a printer.
 
Marshal
Posts: 67356
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On the client or the server?
 
Shailesh Pillai
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both, on the client as well as on the server.
 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use JasperReports with iReport.
 
GS Chidam
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 78
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all for your reply.
 
Doe, a deer, a female deer. Ray, a pockeful of sun. Me, a name, I call my tiny ad ...
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!