You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jochen Schwörer <j....@web.de> on 2002/12/14 08:38:04 UTC

repost: eval_body_include and jasper2

hi,

i have a question concering the difference between EVAL_BODY_BUFFERED and EVAL_BODY_INCLUDE.
if i understand correctly, the only difference is that EVAL_BODY_BUFFERED buffers the output so that it
can be evaluated in doEndTag().

when i have a custom tag which extends BodyTagSupport (and so implements IterationTag) jasper2 generates
the following code:

....
int _jspx_eval_tag_iterate_0 = _jspx_th_tag_iterate_0.doStartTag();
if (_jspx_eval_tag_iterate_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
Cms mycms = null;
if (_jspx_eval_tag_iterate_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
  javax.servlet.jsp.tagext.BodyContent _bc = pageContext.pushBody();
  _bc.clear();
  out = _bc;
  _jspx_th_tag_iterate_0.setBodyContent(_bc);
  _jspx_th_tag_iterate_0.doInitBody();
  mycms = (Cms) pageContext.findAttribute("mycms");
}
do {
....

if my custom tag now returns EVAL_BODY_INCLUDE from doStartTag() the
variable "mycms" is only initialized at the end of the do { } while loop. the TagExtraInfo specifies
"mycms" as VariableInfo.NESTED which means to me that between doStartTag() and doEndTag() my variable
must be properly initialized.
why do i have to return EVAL_BODY_BUFFERED and not EVAL_BODY_INCLUDE from doStartTag() to make my tag work?
this was not necessary in jasper1.

can someone please clarify the behaviour?

thanks in advance

jochen schwoerer


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>