This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes JSP and the fly likes Simplest way to execute a DB query in a JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Simplest way to execute a DB query in a JSP" Watch "Simplest way to execute a DB query in a JSP" New topic
Author

Simplest way to execute a DB query in a JSP

Renato Losio
Ranch Hand

Joined: Nov 23, 2005
Posts: 99
Hi guys,

what's the simplest way to retrieve a count(*) from a DB table in a brand new jsp page?

I need just a very temp page for a few days and I don't really plan to change the DAO design or integrate the new page in the web app. So simply a 'plug & play' page using the Postgres connection JBoss has or even opening a new connection.

I would then take care of the security of the page in the web.xml

Suggestions? Pitfalls?

Cheers,

Renato


Renato Losio - www.arsenio.it - renatoweb@arsenio.it
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
JSTL SQL Tag is your best bet.
Renato Losio
Ranch Hand

Joined: Nov 23, 2005
Posts: 99
Thanks, done. Now, what's the best bet if I like to move the db connection string to a properties file? Using init-param in the web.xml? Something else I can keep separated of the current web app config files?
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Simplest way to execute a DB query in a JSP
 
Similar Threads
Database output in JSP
TOO MANY CONNCTIONS
get data from db in jsp page using struts
Best way to connect/save to two Databases on one page?
a jsp design question...