This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JSP and the fly likes how to communicate between tag & tagExtraInfo Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "how to communicate between tag & tagExtraInfo" Watch "how to communicate between tag & tagExtraInfo" New topic
Author

how to communicate between tag & tagExtraInfo

Vikram Kamate
Greenhorn

Joined: Sep 28, 2002
Posts: 16
Hi,
I am writting generic Tag for executing database query, in this I am executing query in Tag class in doInit method and setting attribute in doAfterBody.
and in TagExtraInfo I want generate jsp scripting varibables for each column with same name of column.
now my problem is I am not able to pass names of columns from tag class to TagExtraInfo class.
Thankx & regards
Vikram.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61103
    
  66

Unless I miss by guess, that can't really happen. The TagExtraInfo class is used at translation time, but the Tag classes aren't created until request time.
You can probably get whatever info you need from the TagInfo instance that you can obtain from the getTagInfo() method of TagExtraInfo.
Remember the javadocs are your friends!
hth,
bear
[ November 10, 2002: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Vikram Kamate
Greenhorn

Joined: Sep 28, 2002
Posts: 16
thankx a lot bear,

you are right, TagExtraInfo is executed at translation time.
But I have basic dought, what is use of TagExtraInfo if we can define scripting varibles only once per tag that too translation time. It could be accomplied by tld file, but I know why sun has choosen this way.

anyway is it possible to define different varibles at runtime?
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1913
    
    6
Take a look at the example on page 158 of Chapter 6 from Professional JSP Tag Libraries. The tag API allows you get access to some of the request-time information such as the values of attributes.
Hope this helps...
Simon
 
 
subject: how to communicate between tag & tagExtraInfo