It's not a secret anymore!
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Is body-content= Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Is body-content="JSP" useless now ?" Watch "Is body-content="JSP" useless now ?" New topic

Is body-content="JSP" useless now ?

Vikrant Pandit
Ranch Hand

Joined: Mar 27, 2006
Posts: 245
Given that body-content can have the following four values


but the body of the tag files and simple tags cannot have scripting elements , so am I right in saying the following statements ?

<body-content>JSP</body-content> is redundant .

<body-content>JSP</body-content> is equivalent to
<body-content>scriptless</body-content> for all practical purposes

Also are the classic tag still allowed to use <body-content>JSP</body-content> ? I guess it is allowed for backward compatibilty


Vikrant Pandit
Deepak Bala

Joined: Feb 24, 2006
Posts: 6662

If you specify a body content that is not allowed ( JSP ) you will get an error. I dont know about classic tags but this is true for simple tags.

SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Vikrant Pandit
Ranch Hand

Joined: Mar 27, 2006
Posts: 245
I tried to run some examples in Tomcat 5.5 / Netbeans ide

Here are my findings

1) Classic Tags are allowed to have all the four values of body-content
i.e. scriptless,JSP,empty and tagdependent

2) Having scripting elements in the body of a classic tag is NOT an error
if the body-content is set to scriptless

Thus it seems tag files and Simple Tags , which were introduced in JSP 2.0 , are not allowed to have scripting elements in their body . Thus only possible values for them are scriptless,empty and tagdependent

However, classic tags can have scripting elements and also all the four values for the body-content.

Surprisingly HFSJ does not talk about this difference.

Ranchers please share your views !!!
Marcus Green
arch rival

Joined: Sep 14, 1999
Posts: 2813
I have a suspicion that the thinking behind this is that users should be moving away from scriptlets towards technologies such as JSTL and EL so they disabled the JSP option for within simple tags and tag files.

SCWCD: Online Course, 50,000+ words and 200+ questions
Shivani Chandna
Ranch Hand

Joined: Sep 18, 2004
Posts: 380

As you have rightly mentioned, classic tags can take JSP in body content as well.
In HFSJ they have not explicitly mentioned the difference. But this point has been discussed often in this forum.


/** Code speaks louder than words */
I agree. Here's the link:
subject: Is body-content="JSP" useless now ?
It's not a secret anymore!