• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt in simple tag and classic tag access

 
raja ram
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Hi,

Any updates on this.

Thanks
 
raja ram
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • 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
 
Sandeep Bhandari
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • 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.
 
Ranil Liyana Arachchige
Ranch Hand
Posts: 71
Hibernate Spring Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic