Context Parameter vs Environment Variable

E

Earl Hokens

I was looking at Environment Variables and Context Parameters in the
Web.xml and I started wondering about the pros and cons of using them
for you application.

It looks to me like there is little difference between them. I
understand that context parameters can really only be a String and the
environment variables have some deploy time type checking based on the
object type assigned to them (to some this may constitute a large
difference). They have the same scope and accessibility within the
application.

Does anyone else have any comments to share?

Thanks,
Earl
 
W

Wendy Smoak

Earl Hokens said:
I was looking at Environment Variables and Context Parameters in the
Web.xml and I started wondering about the pros and cons of using them for
you application.

If it's webapp-specific, I use a context parameter. Things like a URL to
redirect to for authentication, a config file that a Servlet needs to know
the location of.

Information that doesn't have anything to do with the Servlet Container
environment, goes elsewhere. Otherwise, you have to tie the classes that
use that information to the Servlet spec unnecessarily.

(And please pick *one* newsgroup to post to next time. If you're in the
wrong place, someone will let you know.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top