Declaring body-content for a Tag File

The only way to declare body-content type for a Tag File is with another new Tag File directive, the tag directive. The tag directive is the Tag File equivalent of the page directive in a JSP page, and it has a lot of the same attributes plus an important one you won’t find in page directive—body-content.

For a custom tag, the <body-content> element inside the <tag> element of a TLD is mandatory! But a Tag File does not have to declare <body-content> if the default—scriptless—is acceptable. A value of scriptless means you can’t have scripting elements. And scripting elements, remember, are scriptlets (<% ... %>), scriptlet expressions (<%= ... %>), and declarations (<%! ... %>).

In fact, the bodies of Tag File tags are never allowed to have scripting, so it’s not an option. But you can declare body-content (using the tag directive with a body-content attribute) if you want one of the other two options, empty or tagdependent.

You CANNOT use scripting code in the body of a Tag File tag!

The body-content of a Tag File defaults to “scriptless”, so you don’t have to declare body-content unless you want one of the OTHER two options: “empty” (nothing in the tag body) or “tagdependent” (treats the body as plain text).

Inside the Tag File with a tag directive (Header.tag)

image with no caption
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset