• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

using JSTL query

 
Ranch Hand
Posts: 634
Eclipse IDE Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?


 
Creator of Enthuware JWS+ V6
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic