Meaningless Drivel is fun!
The moose likes JSP and the fly likes Usage of JSTL SQL tags Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Usage of JSTL SQL tags" Watch "Usage of JSTL SQL tags" New topic

Usage of JSTL SQL tags

Prasad Babu
Ranch Hand

Joined: Jul 17, 2005
Posts: 57
Hi all,
I am using JSTL SQL tags for populating some form elements in my JSP. It is noted that it should not be used SQL tags for performance or some thing else. I found that its very easy way to populating the elements. My doubt is why dont I have to use SQL tags. Please anybody clearify my doubt.
thanks in advance
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Because it is bad form to put database (DB) access code in a JSP.

Even with the JSTL tags, you lose the separation of concerns that you would get if you put your db code in Javabeans.
Moving all of this code to beans will allow you to add a main method and run all of your initial tests right from the command line. You can later call these methods from unit/integration testing scripts for regression testing.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63858

Even the JSTL Specification itself warns against using these tags for production code.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: Usage of JSTL SQL tags
It's not a secret anymore!