This week's book giveaway is in the General Computing forum.
We're giving away four copies of Learning Regular Expressions and have Ben Forta on-line!
See this thread for details.
Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Printing contents  RSS feed

 
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.
 
Author and ninkuma
Marshal
Posts: 66810
168
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!