Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Empty tag - doStartTag rturn value - API?

 
Madhav Lakkapragada
Ranch Hand
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Guy Allard
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, Guy.
- satya
 
nutan prakash
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Guy Allard
Ranch Hand
Posts: 776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5040
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 776
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic