Empty and Non-Empty Action
If the TagLibraryDescriptor file indicates that the action must always have an empty action, by an <body-content> entry of "empty", then the doStartTag() method must return SKIP_BODY.
Otherwise, the doStartTag() method may return SKIP_BODY or EVAL_BODY_INCLUDE.
For an empty tag, I used EVAL_BODY_INCLUDE in Tomcat 4.0.1 and it still works.
1. Does the JSP Spec talk about this?
2. Does it throw any Exceptions on other servers?
1) You are right it works.
2) I find nothing really useful in the JSP spec. regarding it, other than the usual 'if it is EMPTY, return SKIP_BODY'.
3) It does seem like container code might throw an exception if <body-contrnt> is EMPTY and an invalid value is returned. I don't think it is specified 'tho.
The TLD file specifies a <body-content> element. But the purpose of the <body-content> element is to provide information to third party tools (like editors) about the type of content that can be placed in the body of a custom tag. It has does not have ANY affect on how the custom tag implementation is done.
Once the 1.4 language level + runtime becomes the norm, this seems like a good place for 'assert' in container code.
It has does not have ANY affect on how the custom tag implementation is done.
This is so wrong. :roll:
It does affects the action of the custom tag. And the "action performed" is a result of the Tag implementation.
Primarily intended for use by page composition tools.
So I guess it's fair for the container to do whatever it wants in the face of an invalid return code.
However, I really think the container should not allow illegal/invalid return codes (throw an ISE or something).
This seems like a good example of what happens when your design depends on return codes for status rather than something more robust (like exceptions).