• 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

scripting in tag bodies

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Could someone tell me whether scripting (i.e. scriptlets, declarations and expressions) is ever allowed to appear within the body of custom tags?

At one point in the HFSJ book it says that they are allowed if the TLD for the tag says:

<body-content>JSP</body-content>

But then on P.567 it says:
"...simple tags cannot have a body that includes a JSP expression tag"

Cheers,
Dan
 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
- Classic Tags may have body-content set to JSP (and thus scriptlet in the body)
- Simple Tags may not have body-content set to JSP (and thus scriptlet in the body)


The trick I use to remember it is that SimpleTag has a getBody() method which returns JSPFragment and A JSPFragment MAY NOT CONTENT SCRIPTING (yes, it was written in bold in the Head first, so I remembered it :-)).

By the way, tag files may not have body-content set to JSP either.
 
reply
    Bookmark Topic Watch Topic
  • New Topic