Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need clarification on Ch. 10 mock question 17.

 
Connie Ky Leung
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Why is scripting disallowed in the body of simple and classic tag.

From I read in chapter 10, we can set the body content of simple and classic tag to JSP, empty, scriptless or tagindependant in TLD. Furthermore, tag directive can be defined to set the body content of tag file to empty, scriptless or tagindependant.

How come the correct answers to the question are A and C only?

Is the limitation written in the book or just in JSP spec?

Thanks and regards,

Connie
 
Senthil Nathan.s
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I think because simple tags are going to handle the contents of the body as JSP Fragments since scripting is not allowed in JSPFragments it is not allowed in simple tags.But in Classic tags bodycontent object is used to handle the contents so i think JSP is allowed in classic tags.


Please correct me If I am wrong.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Connie,

Please don't forget to say something when somebody answered your questions
A simple "thanks" will tell us that you've seen our replies.
You've never replied in any of your posts.
 
Connie Ky Leung
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply.
 
Connie Ky Leung
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I read the API of JSPFragement class and JSPFramenet cannot contain scriptlets and scriptlet expression. Thanks for pointing it out in the previous post.

I will verify whether or not classic tag can handle scriptlet and scriplet expressions in its body some other time.

Thanks.
 
MInu
Ranch Hand
Posts: 517
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we put body-content as JSP for simple tags?

Please look at this exception...

"The TLD for the class TagTest.FirstTag specifies an invalid body-content (JSP) for a SimpleTag"

Request anyone to clarify.
 
Connie Ky Leung
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I saw error message of this nature while coding tags for practice. Is it related to the web container we are using. I am using Tomcat 5.0.28.

Regards,

Connie
 
MInu
Ranch Hand
Posts: 517
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont think so.....mine is Tomcat 5.0.16.

'JSP' is an invalid body-content for simple tags.

Please confirm this.

Thanks
 
Connie Ky Leung
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried a simple exercise last night and I could specify JSP body content for classic tag in TLD. I suppose JSP is invalid for simple tag.

Regards,
Connie
 
MInu
Ranch Hand
Posts: 517
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The possible body content values for simple tags,

scriptless(default)
tagdependent
empty


The possible body content values for classic tags,

JSP (Default)
tagdependent
empty.
 
Connie Ky Leung
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the further clarification.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic