• Post Reply Bookmark Topic Watch Topic
  • New Topic

Accessing ServletContext in SimpleTagSupport

 
John Eric Hamacher
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello:

The only solution I've seen to the problem of how to access ServletContext from a SimpleTagSupport instance is to cast the JspContext to a PageContext.
Now I can't be sure all JSP/Servlet containers will allow this. Is there another way of doing this?

Thanks.
Eric
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is the correct way to do it. If you'd like assurance, you can always check the type with instanceof before casting.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!