This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSTL SQL TAG

 
Ramkumar Subburaj
Ranch Hand
Posts: 83
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am developing a small e-commerce site and i came accross the jstl sql tag.

As of now i am using tag handler to do all the db operations and process the data to display it in the jsp page.

can i use the jstl sql tag instead of this and is there any disadvantage in this tag.

and when does the connection close if i use this jstl sql tag
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can i use the jstl sql tag instead of this and is there any disadvantage in this tag.

Yes, you can, but I would strongly recommend you not to. JSP's role is not to shake hands with a database. You'd better go through a dedicated component (servlet, JSF backing bean...) to retrieve the data.

when does the connection close if i use this jstl sql tag

You should have already been discouraged from using these tags But you can still check the JSTL specification, 10.3 <sql:query> and 10.5 <sql:transaction>.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64190
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JSTL Specification itself says not to use these tags for any production code.
 
Ramkumar Subburaj
Ranch Hand
Posts: 83
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your reply.

the current method i am using is by calling a custom tag handler which access the db, puts all the data into bean which in turn is put into a array list.

then i am storing the array list in pagecontext and accessing it in the jsp using EL.

Is there any disadvantage in this approach or is there a better way?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic