Jake,

You can do this all on the server side. You first need to decide how to
display the results. For example, you could have back and next buttons
to move around in the list of invoices. You could also print all of them
in the same page and add some CSS to force page breaks when they are
printed. You could also open a window for each invoice. Another
possibility is to generate PDFs and email them.

Whichever way you decide to go, you should really think about changing
this application. Having JDBC code in a JSP page is a bad practice.
Here's two reasons why: If the app server has a code disclosure bug
(basically, this lets the body of the JSP page be displayed without
processing it), you've just given someone login information to your
database. Second, you have all of the business logic mixed in with your
display logic. This isn't a problem now but what if you need to display
an invoice in a different format? The way you did this isn't reusable so
you'd have to copy the logic around getting the invoice details to
another program and now you have multiple copies of the same logic.
Using a MVC design pattern helps with this (Struts is an example of this
but so is using a simple servlet to create an object that's sent to the
JSP page by putting the object on the request).

You should also consider using connection pooling. All recent app
servers come with a pool managers. The advantage to using them is that
you don't have to establish a connection to the database every time you
need to run a query. This could easily knock a few seconds off of the
display of each page.

Matt

-----Original Message-----
From: web400-bounces@xxxxxxxxxxxx [mailto:web400-bounces@xxxxxxxxxxxx]
On Behalf Of Jake M
Sent: Friday, November 10, 2006 10:24 AM
To: web400@xxxxxxxxxxxx
Subject: [WEB400] Printing multiple invoices from a JSP.

Hello wise people;
I am really close to ending a project but am running out of ideas as to
how
to implement the closing part. Okay, I have two .jsp files. In my first
.jsp(printinvoice.jsp), I query the iSeries and bring up all the
invoices to
be printed and in my second .jsp(produceinvoice.jsp) I create the
invoice
and the user can hit the print button and print that invoice. Now, the
user
wants to print multiple invoices at the same time. Something along the
lines
of having check boxes by the invoices on printinvoice.jsp. I am thinking
it
is almost impossible to do this and want to go to something using Swing
components and install that app on the users workstation. I just did not
want to start up on a whole new solution from scratch if somebody had
run
into something like this before. I am posting the code for
printinvoice.jspand
produceinvoice.jsp below. Any help would be much appreciated. Just
looking
for some direction and I can take it from there. Thanks in advance.
<snip>


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.