| Author |
Empty tag - doStartTag rturn value - API?
|
Madhav Lakkapragada
Ranch Hand
Joined: Jun 03, 2000
Posts: 5040
|
|
According to the API.......
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? Thanks. - satya
|
Take a Minute, Donate an Hour, Change a Life
http://www.ashanet.org/workanhour/2006/?r=Javaranch_ML&a=81
|
 |
Guy Allard
Ranch Hand
Joined: Nov 24, 2000
Posts: 776
|
|
satya - well, I was carried away with the other conversation. 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. Regards, Guy
|
 |
Madhav Lakkapragada
Ranch Hand
Joined: Jun 03, 2000
Posts: 5040
|
|
Thanks, Guy. - satya
|
 |
nutan prakash
Greenhorn
Joined: Oct 28, 2000
Posts: 16
|
|
Hi, 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. Regards, Nutan
|
P.Nutan Prakash<br />SCJP2
|
 |
Guy Allard
Ranch Hand
Joined: Nov 24, 2000
Posts: 776
|
|
Hi - I don't know why, but this thread popped into my mind this morning. Once the 1.4 language level + runtime becomes the norm, this seems like a good place for 'assert' in container code. Regards, Guy
|
 |
Madhav Lakkapragada
Ranch Hand
Joined: Jun 03, 2000
Posts: 5040
|
|
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. Maybe so...... 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. - satya
|
 |
Guy Allard
Ranch Hand
Joined: Nov 24, 2000
Posts: 776
|
|
Hmmmm. The DTD I am looking at says:
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). Regards, Guy
|
 |
 |
|
|
subject: Empty tag - doStartTag rturn value - API?
|
|
|