aspose file tools*
The moose likes JSP and the fly likes JSP Custom tag: Nested or Co-operative? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "JSP Custom tag: Nested or Co-operative?" Watch "JSP Custom tag: Nested or Co-operative?" New topic
Author

JSP Custom tag: Nested or Co-operative?

Bilupto Zena
Greenhorn

Joined: May 18, 2012
Posts: 2
Hello all,


I am trying to create a new custom tag for JSP. Here is the situation:




In the code, first-anchor-tag is anfor insidother custom tag. I am trying to create the new tag inside-tag an incorporate with the first-anchor-tag.
Once the first-anchor-tag get evaluated, I want to create a list of all the keys and values of inside-tag and print it.

I have done some research. But I am new to jsp and custom tag. I know I have to do the following:
1. Add entry to TLD file for "inside-tag".
2. Create and tag handler class for "inside-tag".
3. In the "first-anchor-tag" hanlder file in the doEndTag() method some how I have to make a call to get the list for "inside-tag" variables.


Can some one please give me some idea about how to proceed with this situation?

Many Thanks.

Bilupto.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61662
    
  67

The fact that you mention doEndTag() reveals that you are using the classic JSP 1 tag handling classes. Why aren't you using JSP 2 simple tag classes?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bilupto Zena
Greenhorn

Joined: May 18, 2012
Posts: 2
Bear Bibeault wrote:The fact that you mention doEndTag() reveals that you are using the classic JSP 1 tag handling classes. Why aren't you using JSP 2 simple tag classes?


That's because the: first-anchor-tag handler class is already created. So I just want to create the new tag and incorporate with the already created one.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61662
    
  67

And you can't change it? If you're mucking around with the tags, now would be a good time to update them from JSP 1 to JSP 2, as the latter has been around for 10 years now.

But, no ever listens, so if you want to continue on your current course investigate the findAncestorWithClass() method of TagSupport.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JSP Custom tag: Nested or Co-operative?