Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using JSTL query

 
Mohit G Gupta
Ranch Hand
Posts: 634
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Head First servlets and JSP

chapter9 Using JSTL


5.Which <body-content> element combinations in the TLD
are valid for the following JSP snippet? (Choose all that apply.)



A. tag1 body-content is empty
tag2 body-content is JSP
tag3 body-content is scriptless

B. tag1 body-content is JSP
tag2 body-content is empty
tag3 body-content is scriptless

C. tag1 body-content is JSP
tag2 body-content is JSP
tag3 body-content is JSP

D. tag1 body-content is scriptless
tag2 body-content is JSP
tag3 body-content is JSP

E. tag1 body-content is JSP
tag2 body-content is scriptless
tag3 body-content is scriptless


correct-B,C,E

Tag1 includes scripting code so it must have at
least 'JSP' body-content. Tag2 is only shown
as an empty tag, but it could also contain 'JSP'
or 'scriptless' body-content. Tag3 contains no
scripting code so it may either JSP or scriptless body-content

In the answer its mentioned that Tag3 can have JSP or scriptless as body content

IF JSP is the body content,then it can have scriplets,declarations.
IF scritpless is body content ,then it can have no scripltes,declarations.

i find theses two statements as contradictory.so,
How can Tag3 have JSP or scriptless as body content ?


 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2281
81
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i find theses two statements as contradictory.so,
How can Tag3 have JSP or scriptless as body content ?

It is all about language: in this example Tag3 has no scripting code so scriptless is allowed. It has a body, so empty is not allowed. This leaves JSP as an option: it could be JSP as well because the body you are seeing qualifies for JSP (where pretty much everything is allowed including scriptlets).

Keep in mind that JSP doesn't mean that you have to use scriptlets.

Regards,
Frits
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic