File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Web Application Design Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Web Application Design" Watch "Web Application Design" New topic

Web Application Design

Dan Patsey

Joined: Aug 25, 2006
Posts: 7
Hello, I am creating a web application w/ servlets/JSPs and database access using JDBC. I have about 30 SQL queries that are going to be run against the database in this application. I want to know where I should put these queries so that I can have a servlet execute them. Should I store them all in the servlet? Should I have a separate servlet for each SQL query? Where do I put them?? Thanks =)
John Dell'Oso
Ranch Hand

Joined: Apr 08, 2004
Posts: 130

Without further details on your application, is it reasonable to suggest that you store your SQL queries in a file - perhaps a properties file?

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Keeping them outside of the code is a good idea.

You definitely don't need a separate servlet for each query - the servlet that triggers them should take a parameter to select the proper one.
Dan Patsey

Joined: Aug 25, 2006
Posts: 7
I agree. Here's the link:
subject: Web Application Design
jQuery in Action, 3rd edition