• 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

body-content

 
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello,
there can be four body contents while using tags

JSP
scriptless
tagdependent
empty

My question:
in HF page 487 question 5 says,
If a tag includes scripting code , it must have at least JSP body content
Again for another tag it says, if the tag contains no scripting it may have either JSP or scriptless body content

I m confused as to which situation there wud be a JSP body-content,when there is scripting or when there is not.

what if a tag is "empty"??what can be its body content along wiht"empty"
according to the question, it says an empty tag can have JSP or scriptless.
why not tagdependent??

i m pretty much confused here,help me solve the problem

thanks,
mallika
 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There's a javaranch write up on this:

http://faq.javaranch.com/view?BodyTagContent

Check it out - does it answer your question?
 
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Anupama for clarifying doubts about body-content values in Tag Files, Simple and Classic Tag.
 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mallika,

Let me tell you that the hand notes provided next to the question 5 on pg 487 is with reference to that particular question.I am not sure if my answer will help you resolve your confusion but this is what I have to say:
1)


If a tag includes scripting code , it must have at least JSP body content


This statement tells that if a tag has scripting code in its body then it should have body-content set as JSP the reason is that other three body-content type won't allow scripting code to be evaluated by the JSP translator.
Content-type 'empty' indicates tag should not use body, so this choice is eliminated, 'scriptless' indicates tag should not have scripting elements and 'tagdependent' means the tag body should not be translated by JSP translator therefore any text in the body should be treated as template data.

2)

Again for another tag it says, if the tag contains no scripting it may have either JSP or scriptless body content


This statement was given with reference to <my:tag3> which has body containing an EL. Now since it is EL we could possibly think that this tag can take body content as anything allowed by JSP or anything in JSP except scripting elements. If there were scripting elements then the only choice left for body-content was JSP.

3)

what if a tag is "empty"??what can be its body content along wiht"empty" according to the question, it says an empty tag can have JSP or scriptless. why not tagdependent??


The handwritten statement say that "Tag2 is only shown as an empty tag, but it could also contain 'JSP' or 'scriptless' body-content". When we look at the choices there is no choice in the question which is showing 'tag2 body-content is tagdependent' this is the reason it was mentioned in this manner. However empty tag can have body-content as 'tagdependent' also. In any case body-content tagindependent will treat tag with any code inside its body as template text. I have tested this.

I hope it is clear to you now. I tried to explain from whatever I have understood uptill now.

Thanks,
-Rancy
 
mallika shah
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Rancy,
It was really a nice explanation..
Have got your point..

mallika
 
reply
    Bookmark Topic Watch Topic
  • New Topic