This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JSP and the fly likes Tagfile attributes and parameters Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSP
Bookmark "Tagfile attributes and parameters" Watch "Tagfile attributes and parameters" New topic
Author

Tagfile attributes and parameters

John Hyde
Greenhorn

Joined: Apr 18, 2008
Posts: 10

I'm writing a custom tag using tag files only. I understand that I can read the attributes of a tagfile by <%@attribute name="" %>, but can I read anything which is passed in the tag body?
i.e

I can get the attribute by

but how do I read the param values? is it even possible?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63202
    
  69

The obvious question is, why would you do that? It's just awful design in my opinion. If you want to pass data to the tag, that's what the attributes are for.

Or are you really asking a more general question about dealing with child elements?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
John Hyde
Greenhorn

Joined: Apr 18, 2008
Posts: 10

Bear Bibeault wrote:The obvious question is, why would you do that? It's just awful design in my opinion. If you want to pass data to the tag, that's what the attributes are for.

Or are you really asking a more general question about dealing with child elements?


I need to pass a list of values, right now I'm accomplishing this by having two attributes like


I feel passing parameter list is much cleaner
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 63202
    
  69

It's been a long time since I futzed around with JSP tag files, but I'm not sure you are going to be able to do what you want with them. (But I could be wrong.)

Dealing with child tags is relatively straight-forward using SimpleTags.
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Tagfile attributes and parameters
 
It's not a secret anymore!