• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

scripting in tag bodies

 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
For my next feat, I will require a volunteer from the audience! Perhaps this tiny ad?
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic