• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

taglib custom tags

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi everybody.
I'm new to JSP programming, even if I have a fair knowledge of Java.
I would like to use custom tags, and to nest them into each other attributes... something like that



I've seen many tags used like this (as c:url for examble) but I'm not able to do this.

Can anybody help me?

Thanks,
Stefano
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, you haven't seen that. You cannot use a custom tag as an attribute value of another custom tag.
 
Stefano Cazzola
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, you are right. I didn't see that. I saw (and used)

I supposed it was a standard behavior and that it was possible also with custom tags.

However I found a solution (quite verbose but effective) to use the output of a custom tag as value for an attribute of another custom tag


Stefano
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Stefano Cazzola wrote:I supposed it was a standard behavior and that it was possible also with custom tags.


Ahhhh! This is an important distinction. HTML tags, and all other client-side markup is just template text to the JSP engine. It could be the Magna Carta as far as the JSP engine is concerned -- it doesn't apply any semantics to it whatsoever.

However I found a solution (quite verbose


The more standard way is to store the output of the custom tag in a scoped variable, and then use the EL to supply that value as the attribute value.
 
Stefano Cazzola
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bear!
I'll follow the standard way, then.

Bye,
Stefano
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic