• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

behaviour of doStartTag of TagSupport

 
Ranch Hand
Posts: 35
Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
My CustomTagHandler that extends TagSupport:


The Jsp that calls this:


I am given to understand that by default(when the doStartTag isnt overridden, the behaviour is to skip the Body. Since I am returning neither of teh expected return values, shouldnt the default behaviour kick in? I assume returning an arbitrary return value integer is similar to not overriding the doStart method as far as default behaviou is concerned. On the contrary, I observe the below output:
The output from the Jsp is

which means that the body is evaluated.

Could someone please suggest.
 
Ranch Hand
Posts: 110
Firefox Browser MySQL Database Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The valid return values for doStartTag() function are SKIP_BODY and EVAL_BODY_INCLUDE. If the function doStartTag is not overriden then default value SKIP_BODY is returned.

The function doStartTag is overriden and the returned value 9911 is not valid return value. The default behaviour applied only when the function is not overridden.
From the Tomcat 6.x source code it seems that if the return type is not equal to SKIP_BODY then return type is considered as EVAL_BODY_INCLUDE

if the doStarTag returns EVAL_BODY_INCLUDE and if the custom tag has body then body is evalauted once.


Hence "hello" is displayed as output
 
Ranch Hand
Posts: 113
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
are you using Tomcat 6.x?
 
Royston Monteiro
Ranch Hand
Posts: 35
Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Venkat Divvela Yesterday 02:33:22 Subject: behaviour of doStartTag of TagSupport

--------------------------------------------------------------------------------

The valid return values for doStartTag() function are SKIP_BODY and EVAL_BODY_INCLUDE. If the function doStartTag is not overriden then default value SKIP_BODY is returned.
view plaincopy to clipboardprint?
# public int doStartTag() throws JspException{
# return 9911;
# }
# public int doStartTag() throws JspException{
# return 9911;
# }
The function doStartTag is overriden and the returned value 9911 is not valid return value. The default behaviour applied only when the function is not overridden.
From the Tomcat 6.x source code it seems that if the return type is not equal to SKIP_BODY then return type is considered as EVAL_BODY_INCLUDE

if the doStarTag returns EVAL_BODY_INCLUDE and if the custom tag has body then body is evalauted once.

view plaincopy to clipboardprint?
<mytag:ClassicTag >Hello</mytag:ClassicTag>
<mytag:ClassicTag >Hello</mytag:ClassicTag>
Hence "hello" is displayed as output



Thanks. That explains it.

Souvik Dasgupta Today 14:22:40 Subject: behaviour of doStartTag of TagSupport

--------------------------------------------------------------------------------

are you using Tomcat 6.x?



Yes, I am using Tomcat 6
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic