This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes JSP and the fly likes Print Jsp page(s) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Print Jsp page(s)" Watch "Print Jsp page(s)" New topic
Author

Print Jsp page(s)

Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
Hi all,

I'm using the value list handler pattern to display the recordset in multiple pages.
10 records are displayed per page , when the next button is clicked the same page will get reloaded withe the next 10 rows.

Now i face a problem in printing the records , when ever print button is clicked i want to print all the pages.

How can i do this ? Is there any feasible solution ?
Plz guide me..

Srini


Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
create a JSP that displays all the records in a printable layout and open that on pressing the button.


42
Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
Originally posted by Jeroen Wenting:
create a JSP that displays all the records in a printable layout and open that on pressing the button.


Cant i do the same without opening any new page ?
Wat i was thinking is to have a hidden iframe that has all the contents & print the same ... but it's not working ..

Srini
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
try it out without using iframe. just load the printable version in the same page.
Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
Originally posted by adeel ansari:
try it out without using iframe. just load the printable version in the same page.


Adeel,
I cant get u ..
See for example i'm in one page if i give print i need to print all the pages.
Do u mean to load all the records in one page and print the same..

Srini
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
yeah. just give it a try.

but i think there shouldn't be any problem using iframe. it should work fine.

are you printing directly from the browser or using some javascript print function for the browser?
[ October 14, 2004: Message edited by: adeel ansari ]
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
the problem with that approach is that you ALWAYS send all data over the network even if you're not displaying it.
As paging is usually employed to prevent just that you're being counterproductive here.
Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
Originally posted by Jeroen Wenting:
the problem with that approach is that you ALWAYS send all data over the network even if you're not displaying it.
As paging is usually employed to prevent just that you're being counterproductive here.


So what shd i do ?

Now i'm popping up a small new window, which closes immediately after printing all the records.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
that's likely the best way, and is used frequently (also for example when the regular page contains things like menus, colours and stuff you don't want on the printed page).
Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
Originally posted by adeel ansari:
yeah. just give it a try.

but i think there shouldn't be any problem using iframe. it should work fine.

are you printing directly from the browser or using some javascript print function for the browser?

[ October 14, 2004: Message edited by: adeel ansari ]


I'm using the javascript function for printing.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Originally posted by srini vasan:


So what shd i do ?

Now i'm popping up a small new window, which closes immediately after printing all the records.


sounds fine.
 
Consider Paul's rocket mass heater.
 
subject: Print Jsp page(s)