Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

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: 40913
840
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 ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic