Thursday, November 10, 2005

Why we don't have attributes in config like context??

What would you use them for?
Remember, there is only one ServletContext object per web application (or per JVM in a cluster). So it makes sense for a servlet to be able to set attributes on the context object so they may be retrieved by other servlets.

However, there is one ServletConfig object for every servlet. If a servlet were able to set an attribute on the config object... the only servlet that could retrieve it would be the same servlet. There is simply no reason for it.


Post a Comment

<< Home