• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 275
  • Last Modified:

how to print in Java?

hi guys,
i try to do a print job in java. i have a JSP page, when you click the "print" button, my application has to print the receipt to user. how to do that? i am totally new to java/JSP.
can i call print popup window just like we do in ASP.NET/C#? And let user to set the print configuration and print the page? if so, that will be great. Otherwise, we have to manually do the print job, right?
COULD YOU PLS GIVE ME SOME SAMPLE CODE OR POINT ME TO THE RIGHT DIRECTION? REALLY APPRECIATED.

thanks heaps
viola
if (form.ButtonClicked("print_button"))
  {
    //do print job, HOW TO PRINT?
  }

Open in new window

0
viola123
Asked:
viola123
1 Solution
 
KuldeepchaturvediCommented:
Its more of a Javascript then jsp or java code..

try the code below.
if (form.ButtonClicked("print_button"))
  {
    window.print();
  }

Open in new window

0
 
viola123Author Commented:
hi,
it is so greate.
this is the solution:
<form>
<input type="button" value="Print this page" onClick="window.print()">
</form>
thanks a lot
viola
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now