• Post Reply Bookmark Topic Watch Topic
  • New Topic

TagSupport.getParent() returns null  RSS feed

 
Himai Minh
Ranch Hand
Posts: 1518
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a classical tag like this:



I got a null pointer exception in from line 19 when I called tag.doStartTag().
Why ?
 
Himai Minh
Ranch Hand
Posts: 1518
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now, I figured out why.
I modified the code:


Now, it prints *JSP *insideJSP *
where the doStartTag prints *.
The outer tag does not have a parent. That is why getParent() returns null.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!