Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using tags in scriptlets

 
Albert Schweitzer
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
Albert
 
Albert Schweitzer
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
;-D
Greetz,
Albert
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic