aspose file tools*
The moose likes Servlets and the fly likes Init / Context Parameters revisted Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Init / Context Parameters revisted" Watch "Init / Context Parameters revisted" New topic
Author

Init / Context Parameters revisted

Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

Hi,

I see where this has been gone over in other posts, but I'm having a bit of trouble with something and thought maybe someone could tell me why something doesn't work.

What I used to have was this: http://www.javaranch.com/ubb/Forum7/HTML/000638.html
If you look at the third entry in this thread, you'll see that i used initialization parameters, then obtained a servlet context, and placed each of these init params into the servlet context.

Then I was told, (later in the thread) that I was doing something the hard way.

So here is what I have now, except it's not working... Can someone tell me why?

web.xml
servlet code:This code throw a servletException, because the value of my envSTRINGS are null. How come?
Mike Curwen
Ranch Hand

Joined: Feb 20, 2001
Posts: 3695

I have answered my own question. There were two things wrong. I was using getAttribute, but I should have still used getInitParameter.

Secondly, as my comments enlighten me (because I'll forget 6 months from now why I did something seemly silly), the context attributes are different than the parameters.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Init / Context Parameters revisted
 
Similar Threads
deployment descriptor
Cannot find servlet init parameters
Log4j
ServletContext InitParameter Problem
JSP Initialization Parameters