Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Doubt in simple tag and classic tag access

 
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have following code


and below code


in my jsp when i say
<test:child>
<test:testing user="s_2">hi</test:testing>
</test:child>

this throws class cast exception but

<test:testing user="s_2">
<test:child/>
</test:testing>

works fine

here my child tag handler is Classic(Child) and testing tag handler is SimpleTag(TesTag).

when i have Classic tag inside Simple Tag it works but reverse will throw me class cast exception. I know that Simple tag can access Simple and classic tag and Classic tag can access only classic tag but i am not able to map it back with the code can any body explain me this?


Thanks
[ September 10, 2008: Message edited by: raja ram ]
 
raja ram
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Any updates on this.

Thanks
 
raja ram
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Can any body through some light on this so has to say what exactly is causing the class cast exception.

Thanks
 
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
well the exact answer can be given by studying the implementation of TagSupport and SimpleTagSupport classes. But to give you a rough idea:

SimpleTagSupport is superset of TagSupport and hence can be the parent tag for classic tag.
But the reverse is not true and hence the issue yor are facing.

Will post more on this after doing a bit more research.
 
Ranch Hand
Posts: 71
Hibernate Spring Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when you say getParent() in SimpleTagSupport it returns JspTag i guess, could you just have a look at that.
 
Sandeep Bhandari
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes, the culprit is setParent method

setParent() returns a JspTag object,
the returned parent tag can implement the Tag, BodyTag, IterationTag, or the
SimpleTag interface
 
joke time: What is brown and sticky? ... ... ... A stick! Use it to beat this tiny ad!
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic