Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • 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
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

A knowledge to share..

 
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
question from Enthuware mock.

Given that a tag testlib:myFirstSimpleTag extends SimpleTagSupport. What should be done so that scriptlet code can be used in the body of this tag?
1. body-content should be set to JSP in the TLD for this tag.
2. scripting-enabled should be set to true in the TLD for this tag.
3. Create a classic tag adapter for this tag that has the body-content of JSP.
4. This cannot be done because it is a Simple tag.
5. None of these.

I just wanted to share with the ranchers , who goona write the SCWCD soon From the above option you might be temped to select option 1 as like i did

but actualy option 4th one is the correct choice.

To use scriptlets in a tag's body, its body-content must be JSP. Now, the body of a SimpleTag is translated into a JSP fragment and since JSP fragments do not support scriptlets, the <body-content> of a SimpleTag cannot be JSP. A TLD is invalid if it specifies JSP as the value for <body-content> for a tag whose handler implements the SimpleTag interface. JSP containers are recommended to but not required to produce an error if JSP is specified in this case.
moreover according to spec JSP 2.0


A translation error must occur if a piece of JSP code that is to be translated
into a JSP Fragment contains scriptlets or scriptlet expressions.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for sharing
We also have a related FAQ about the body-content for tags.
 
Poonam Agarwal
Ranch Hand
Posts: 324
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you
 
Ranch Hand
Posts: 47
Netbeans IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thanks cleared my doubts.
 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
WoW . Thanks a million for sharing
Kind Regards.
Hasnain
 
You got style baby! More than 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
reply
    Bookmark Topic Watch Topic
  • New Topic