Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

application/ServletContext attribute in custom tag?  RSS feed

 
Sylven Yip
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i set an attribute in ServletContextListener


and i test it in a jsp page:

and it shows flase and impove that the attribute is not null.

now i try to get it in the custom tag:


but it throws NullPointerException

is there anything wrong?

[ September 12, 2007: Message edited by: Sylven Yip ]
[ September 13, 2007: Message edited by: Bear Bibeault ]
 
Joan Horta Tosas
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post the entire custom tag code. I hope you're not trying to access the JspContext in the constructor if you're extending SimpleTagSupport...
 
Sylven Yip
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you,Joan.
you are right,i put the sentance in the constructor.
now i know the problem,the container invoke setJspContext() after construct.
thanks~
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!