• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Putting SQL statements in MVC application

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I'm creating a simple Java App. which involves MySQL database interaction.

What would the best place to put my SQL statements or access database?

Create JavaBeans? Can I embed it in JSP?(Is it possible!!!)

Thanks,

Vin
 
author & internet detective
Posts: 41919
910
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Vin,
While it's possible to put the SQL in JSPs, it is very strongly recommended against. It is best to put the SQL in a Java class that is called from the servlet. The servlet stores data in the request and forwards to the JSP.
 
Ranch Hand
Posts: 1087
Oracle Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Putting SQL statements in MVC application



Vin,

When you say MVC, what do you understand by MVC ?

MVC is a Model-View-Cotroller architecturev and a sql can never be part of any view.
JSP is part of the view and actually you should plcace sql some where in model or bean

Now you are better one who can decide

in short don't put sql in jsp what Jeanne said
[ April 06, 2005: Message edited by: Shailesh Chandra ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic