File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Using tags in scriptlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Using tags in scriptlets" Watch "Using tags in scriptlets" New topic

Using tags in scriptlets

Albert Schweitzer

Joined: Oct 25, 2002
Posts: 6
Hi folks,
allthough I know that the intention of TagLibs is different, I want to
use the functionality of a tag in a scriptlet. Is there a way to do that?
And when, what does the syntax look like?
To be more concrete:
I use the Jakarta-DB-Taglib. As usuallay I make a connection. And then I
want to check the existence of a specific userID before creating it.
so what I want to do is:
- make a query
- check the rowCount
And so I assumed there is a way to do something like
<% if(!<db:rowCount>.equals("0")) { %>
There's allready a user with that ID!
<% } %>
Can anyone help? :roll:
Thanks in advance!

Kommt Zeit, kommt Bart!
Albert Schweitzer

Joined: Oct 25, 2002
Posts: 6
Everything's allright! I found it myself!
If anyone is interested, here is how you can manage it.
- make a connection with the concerning tag
- start a statement tag
- after query and the result-tags, you can then access the rowcount
in a scriptlet with
(Integer)pageContext.getAttribute ("org.apache.taglibs.dbtags.resultset.rowcount");
For some this will be obvious, for me it was some kind of tricky to find!
I agree. Here's the link:
subject: Using tags in scriptlets
It's not a secret anymore!