This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
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


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Web Application Design" Watch "Web Application Design" New topic
Author

Web Application Design

Dan Patsey
Greenhorn

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
Dan,

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

Regards,
JD
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42357
    
  64
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.


Ping & DNS - my free Android networking tools app
Dan Patsey
Greenhorn

Joined: Aug 25, 2006
Posts: 7
thanks!
 
 
subject: Web Application Design