This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan 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 | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » JSP
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://aspose.com/file-tools
 
subject: Simplest way to execute a DB query in a JSP
 
Similar Threads
Best way to connect/save to two Databases on one page?
get data from db in jsp page using struts
a jsp design question...
Database output in JSP
TOO MANY CONNCTIONS