• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

application/ServletContext attribute in custom tag?

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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~
reply
    Bookmark Topic Watch Topic
  • New Topic