This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do you set a servlet context attribute?

 
Dave Alvarado
Ranch Hand
Posts: 436
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm using Tomcat 6.0.26. I have this in my web.xml file ...



But in my servlet, this call returns null ...



So my question is, what is the right way to set an attribute of a servlet context?

Thanks, - Dave
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wrong method. Check the API again.
 
Dave Alvarado
Ranch Hand
Posts: 436
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Come on, man, I need a little bit more than that. What is the "wrong method"?
 
Poobhathy Kannan
Ranch Hand
Posts: 94
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think you should have used ServletContext#getInitParameter method
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dave Alvarado wrote:Come on, man, I need a little bit more than that. What is the "wrong method"?

Learning to read the Javadoc is an important skill.
 
Elchin Asgarli
Ranch Hand
Posts: 222
Chrome Eclipse IDE Google Web Toolkit
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:
Dave Alvarado wrote:Come on, man, I need a little bit more than that. What is the "wrong method"?

Learning to read the Javadoc is an important skill.


And what about this? http://faq.javaranch.com/java/BeNice
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is not nice about teaching people something?
 
Madhawi Maurya
Ranch Hand
Posts: 42
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

you should write like


 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic