|
My personal opinion is to never do database stuff in a JSP. To many wacky things go on to make a JSP work, and the last thing you want is a hanging database connection. I'd make the queries in a bean, and return the results as an array of Strings or something.
Also, the way I do database connection is to put them in a try . . . finally block, closing the connection in the finally section. This helps ensure that regardless of runtime exceptions, the database connection will (through best-efforts) get closed.
|