Current location: Hot Scripts Forums » Programming Languages » Everything Java » Printing a JSP Report without viewing/using IE Print button


Printing a JSP Report without viewing/using IE Print button

Reply
  #1 (permalink)  
Old 11-13-06, 11:23 AM
mike.whay mike.whay is offline
New Member
 
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Printing a JSP Report without viewing/using IE Print button

Hi

I have a .JSP program whixch generates on screen a report, this is called from a button on another screen. Works fine but what I would ideally like is for the report to be printed straight away to the default printerrather than having to show it on screen and then use IE print fucntionality

Thanks

Mike
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 11-13-06, 05:48 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
JSP = Java Server Pages, which is not Javascript. This might be better off here... topic moved.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 11-13-06, 06:58 PM
King Coder King Coder is offline
Community VIP
 
Join Date: Jan 2006
Posts: 703
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by mike.whay
Hi

I have a .JSP program whixch generates on screen a report, this is called from a button on another screen. Works fine but what I would ideally like is for the report to be printed straight away to the default printerrather than having to show it on screen and then use IE print fucntionality

Thanks

Mike
I think adding JavaScript to your page would be the best solution. Messing with the Java printing API's is probably overkill. Use this javascript function:

Code:
<script language="JavaScript">
   if (window.print)
   {
      window.print()
   }
</script>

Let me know if does/doesn't work.
__________________
my site
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 11-14-06, 08:36 AM
mike.whay mike.whay is offline
New Member
 
Join Date: Nov 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks

Thanks, that worked exactly as I wanted

Mike
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 11-15-06, 05:08 PM
King Coder King Coder is offline
Community VIP
 
Join Date: Jan 2006
Posts: 703
Thanks: 0
Thanked 0 Times in 0 Posts
You may want to check if the user has javascript enabled. If they don't, then you can use your previous code redirecting to a report page.
__________________
my site
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Classified Ads skipper23 Perl 3 11-22-05 03:22 AM
CGI problem - Script only allows a small number of digits in my customers site url??? Ireland Perl 6 10-09-05 08:09 PM
Mysql Search Output Question doveroh PHP 0 02-15-05 08:39 PM
formmail problem gscraper Perl 12 08-27-04 04:06 AM
Upload Script Problem!!! seanknighton Perl 0 03-21-04 10:54 PM


All times are GMT -5. The time now is 11:06 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.