• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ServletContext getAttributeNames

 
Sandip Kaviman
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question from David Bridgewater Book, Chapter 3, question 9



I think the answer is B, but the answer is given is C, with explanation "There should be at least one context
attribute set by the servlet container; hence, the Enumeration is unlikely ever to be empty"

Can someone throw some light on this? which is the attribute that container set?

Thanks
Sandip
 
Dee Brown
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Based on my reading of the spec and the HSF book, I have not come across anything that suggests containers are required to store a specific context attribute.
 
Kunal Jag
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Based on my reading of the spec and the HSF book, I have not come across anything that suggests containers are required to store a specific context attribute.


Every container sets some attributes (depending on the Web server implementing the specification). For instance, Tomcat 5 sets the following context attributes:

1. org.apache.catalina.jsp_classpath
2. org.apache.catalina.WELCOME_FILES
3. javax.servlet.context.tempdir
4. org.apache.catalina.resources

The following code snippet demonstrates the same:


Regards,
 
Sandip Kaviman
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot Kunal,
Actually I was expecting reply from you !



Sandip
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic