This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach 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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 60740
    
  65

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: 60740
    
  65

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.
 
Consider Paul's rocket mass heater.
 
subject: Tagfile attributes and parameters
 
Similar Threads
taglib-directive tagdir and uri
JSP 2.0 tagfile problem
tag files and body content
tag file question
querry relating to Tag library