my dog learned polymorphism
The moose likes Servlets and the fly likes which one is better to use in project Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "which one is better to use in project" Watch "which one is better to use in project" New topic

which one is better to use in project

Kaleeswaran Karuppusamy
Ranch Hand

Joined: Jul 19, 2007
Posts: 155
1.In Struts framework we are using datasource(connection pooling)
we stored and retrieved value from database using DAO class.

2.But in JSTL core having <sql:query>,<sql atasource> ect.

but i am working in struts framework we are using DAO class.

which is better to use either DAO class or jstl tag in jsp,please tell me the reason?

Judge a man by his questions rather than his answers --Voltaire
SCJP 1.5 97%
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Avoid the JSTL SQL tags; they should not be used for any serious application. Using them mixes data access code with the presentation layer, which is considered really bad design.
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

What Ulf said.

From the JSTL Spec.

Many web applications need to access relational databases as the source of dynamic data for their presentation layer. While it is generally preferred to have database operations handled within the business logic of a web application designed with an MVC architecture, there are situations where page authors require this capability within their JSP pages (e.g. prototyping/testing, small scale/simple applications, lack of developer resources). The JSTL SQL actions provide the basic capabilities to easily interact with relational databases.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link:
subject: which one is better to use in project
It's not a secret anymore!