• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

scripting in tag bodies

 
Dan Murphy
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
 
Rodrigo Alvarez
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic