• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question on body-content tag.

 
Vicky Rajawat
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I'm preparing for wcd using headfirst Servlets and jsp. In one chapter its written that the <body-content> element can be one of either three or four values , depending on the type of tag.
Values are:(empty, scritpless, tagdependent, JSP.)
Now in the next chapter its written that the body of a tag that invokes a simple tag handler is encapsulated in the JspFragment object and it can't contain any scripting elements.
But doesn't giving "JSP" as the body-content fields value, let you do just that? I mean If I give "JSP" as the body-content value then I can use scripting elements right?
So how does this make sense?
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2345
90
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Vicky,

SimpleTags cannot contain "JSP" as a body-content value (as opposed to ClassicTags).

Regards,
Frits
 
Vicky Rajawat
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply frits. By the way, are classic tags part of OCJEEWCD 6? They are in the 2nd edition of HFSJ but can't seem to find it in the syllabus on the oracle site.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2345
90
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By the way, are classic tags part of OCJEEWCD 6?

That is a good question, they used to be there in SCWCD 5, and if you check the Exam Topics on the Oracle site you would say they are not there anymore...

Have you checked the stories from the people that did the exam recently? (maybe you can check the ScwcdLinks as well)

Regards,
Frits
 
Vicky Rajawat
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess I'll study that as well. Although I seem to remember someone saying that there were no questions from classic tags.
Thanks again
 
Vicky Rajawat
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Frits Walraven wrote:Hi Vicky,

SimpleTags cannot contain "JSP" as a body-content value (as opposed to ClassicTags).

Regards,
Frits

Ok so I was doing examulator.com quiz on custom tags.
One question was
Which of the following statements are true of custom tags that are created by extending the SimpleTagSupport class.

One option was

It can't have JSP as body-content type.
I chose that option but later they told me that it was the wrong answer.

By the way some question seems to be quite vague.
For example
Tag files must be in WEB-INF/tags or a subdirectory of that directory.
I mean they can also be in lib directory if it's a part of jar file, so technically this option is wrong, right?
But they have it as the right option. Exam question won't be this vague?

Thanks for the reply in advance
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2345
90
Android Chrome Eclipse IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It can't have JSP as body-content type.
I chose that option but later they told me that it was the wrong answer.


That is indeed wrong. Just verify those kind of answers with the specifications, like this one can easily be found in the JSP 2.0 specs:

JSP.7.1.5 Simple Tag Handlers
The body of a Simple Tag, if present, is translated into a JSP Fragment and passed to the setJspBody method. The tag can then execute the fragment as many times as needed. See Section JSP.7.1.6 for more details on JSP Fragments. Because 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.


Tag files must be in WEB-INF/tags or a subdirectory of that directory. I mean they can also be in lib directory if it's a part of jar file, so technically this option is wrong, right?

You are right.
Exam question won't be this vague?

Yes, they won't be ambigious like that. There are a lot of (free) mock exams around with poor quality. If you are really want good questions and answers, you should consider Enthuware. For me the best preparation in any java certification exam.

Regards,
Frits
 
Vicky Rajawat
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks once again. Cheers
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic