• 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
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic