aspose file tools*
The moose likes JSP and the fly likes JSTL SQL TAG Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSTL SQL TAG" Watch "JSTL SQL TAG" New topic
Author

JSTL SQL TAG

Ramkumar Subburaj
Ranch Hand

Joined: Sep 07, 2007
Posts: 83
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


SCJP 1.5, SCWCD 1.4.
Hanging between Web Services and EJB
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

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>.


[My Blog]
All roads lead to JavaRanch
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61654
    
  67

The JSTL Specification itself says not to use these tags for any production code.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Ramkumar Subburaj
Ranch Hand

Joined: Sep 07, 2007
Posts: 83
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
 
subject: JSTL SQL TAG