Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

So where are scriptlets never allowed?

 
warren li
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The body of the tag that is a TAG FILE can not have scriptlets.

The body of a simple tag that extends SimpleTagSupport can not have scriptlets, because its body is a JspFragment that does not allow scriptlets.
So does this mean this is illegal for a simple tag tld:
<body-content>JSP</body-content>
?


What about classic Tag handler that extends TagSupport and BodyTagSupport? Can we put scriptlets in the tag body?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So does this mean this is illegal for a simple tag tld: <body-content>JSP</body-content> ?

JSP is an illegal value for the <body-content> tag.
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about classic Tag handler that extends TagSupport and BodyTagSupport? Can we put scriptlets in the tag body?


Yes you can specify body content as "JSP" which includes anything you can write in a jsp file.
 
warren li
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for all the answers. So am I right to say that only classic tag handlers can have scriplets in the tag body, while tag files and simple tags cannot?
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic